Link to home
Start Free TrialLog in
Avatar of aspirinmornings
aspirinmornings

asked on

Using "clear" button to set focus to text box

I have a button called called btnclear
I want to make it so that when i click it it clears all the text fields and sets the focus to my text box called tstFirstName.Text

Thanks for the help i am new as you can see in the code below i am using the easiest way i know how to clear them
txtFirstName.Text = ""
txtLastName.Text = ""
lblNameOutput.Text = ""
txtFirstNum.Text = ""
txtSecondNum.Text = ""
lblNumOutput.Text = ""

Open in new window

Avatar of Ashish Patel
Ashish Patel
Flag of India image

right, you code is good and has no issues, now on the btnclear click just write your code and the end write txtFirstName.setFocus()

txtFirstName.Text = ""
txtLastName.Text = ""
lblNameOutput.Text = ""
txtFirstNum.Text = ""
txtSecondNum.Text = ""
lblNumOutput.Text = ""
txtFirstName.setFocus()
Avatar of aspirinmornings
aspirinmornings

ASKER

when i do that it comes up with a #3 error
it says 'setFocus' is not a member of "system.Windows.Forms.TextBox'.
ASKER CERTIFIED SOLUTION
Avatar of Ashish Patel
Ashish Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
THANKS!!