Srihari
Srihari

Reputation: 2429

How to set focus to a textedit on buttonclick in C# Winforms?

I need to set focus to a textedit on Button Click event ? in my Form i tried this one but not working TXE_FlatDiscountP.Focus(); How to set focus on event ?

Upvotes: 0

Views: 1468

Answers (1)

Priyanka Sonawane
Priyanka Sonawane

Reputation: 36

Your way is correct. Maybe you are missing something.To be more detailed here is an example:

private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Focus();
        }

This is an example of setting focus to a textbox.

Upvotes: 1

Related Questions