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 button locationsavebutton

  • after clicking button groupboxcontrol should set visible , firstnametextbox shall 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

windows forms

after clicking groubbox set visible , other textboxes visible , focus set firstnametextbox

enter image description here


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -