Hi
I have a form with text boxes and a button.
I have set the tabindex - but the textbox with tabindex set to 1 is not the first thing active when i press tab.
Newbies hay - hope thats not so abvious to fix. lol
There is no default focus - so I have to manual select the terxt box and i want ot be automatically be selected after pressing a radio buton. How do i set the focus for this and can pressing enter move the focu to the next text box? How can i make pressing enter in the last textbox run the click event of a button (what do u sed as the arguments, sender and e?
Hope that makes sence.
Regards.
Loading

VulpesRank #55 · 29.2K reputationPosted Apr 7, 2011, 6:15 AM EDT
VulpesRank #55 · 29.2K reputationPosted Apr 6, 2011, 7:01 AM EDT
You can force focus onto a control like this:
textBox1.Focus();
If you set the Form's AcceptButton property to the appropriate Button, then it will be clicked automatically when the user presses ENTER.
Richard Brennan89 reputationPosted Apr 6, 2011, 12:38 PM EDT
can i change the form accept button property in code. The form can be made bigger and more txtboxes appear - if t his happens a diffeent button accepting enter would be useful.
While I'm here - what the easiest way to make it things look less - old windows style? If the answer is WPF or XML i will have to leave that w while.
VulpesRank #55 · 29.2K reputationPosted Apr 6, 2011, 1:33 PM EDT
If you want the size of the controls to change in proportion to the change in the form's size, then you'll need to set their Anchor properties - see http://msdn.microsoft.com/en-us/library/system.windows.forms.control.anchor.aspx
Richard Brennan89 reputationPosted Apr 6, 2011, 2:44 PM EDT
VulpesRank #55 · 29.2K reputationPosted Apr 7, 2011, 12:55 AM EDT
this.AcceptButton = button1;
Richard Brennan89 reputationPosted Apr 7, 2011, 5:01 AM EDT