Problem with Buttons and TextBox with the Title of the form

0

I have a problem with the buttons and a textbox, my intention is that in a textbox people write what they want and that is changed in the title of the form but I have no idea how to do it and the same with the buttons that people give a button and change the title of the form.

    
asked by Ohh Liberr 28.07.2016 в 23:16
source

1 answer

2

You only have to change the Text property of the form to the text you want to set as the title.

If you want the title to change when you change the text of a TextBox:

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
        Text = textBox1.Text;
    }

If you want to change by pressing a button the code should be in the Click event of the button:

    private void button1_Click(object sender, EventArgs e)
    {
        Text = textBox1.Text;
    }
    
answered by 28.07.2016 / 23:29
source