c# - issue with setting focus not working -
i have screen user enters in text box name of location. click on button open group box has 3 textboxes firstname, lastname , pw. trying set focus firstname text box when user clicks button make group box visible (on main form). not set focus (txtbxnamefirst.focus();)
requirement
i understood following:
user writes text
locationtextbox, clicks buttonlocationsavebuttonafter clicking button
groupboxcontrolshould set visible ,firstnametextboxshall receive focus
the code
the button clicked after entereing location locationbutton has click event code
private void locationbutton_click(object sender, eventargs e) { // value textbox location string location = locationtextbox.text; // make groupbox visible groupbox1.visible = true; // set focus textbox firstname firstnametextbox.focus(); } simple demo windows forms
this how application looks before clicking button
after clicking groubbox set visible , other textboxes visible , focus set firstnametextbox


Comments
Post a Comment