Hi, I have the following situation. I have a main form with two panels
divided by a splitter. The first panel has some links that when clicked, add
forms into the second panel. I am trying to set focus in the first textbox
in those forms. I have tried Textbox1.focus on the form_activated event, I
have tried setting the focus immediately after the InitializeComponent
statement to no avail. When the form is loaded, I have added
Form1.Activate(), again no solution, The form that is always active is the
main form, not the loaded form inside the panel, even though I am inputting
text etc. Has anybody run into this problem? any suggestions/hacks? any help
is appreciated. thanks
Jose
TheVP - 08 Dec 2004 13:27 GMT
I believe the vb fix would be:
me.activecontrol = textbob1
and the c# is:
this.activecontrol = textbox1
> Hi, I have the following situation. I have a main form with two panels
> divided by a splitter. The first panel has some links that when clicked, add
[quoted text clipped - 8 lines]
>
> Jose
Jose Rodriguez - 09 Dec 2004 16:21 GMT
I tried it but it didn't quite work, but having said that, you put me in the
right track, the solution was to add this in the frmMain so the form within
the container panel becomes the activecontrol
this.ActiveControl = this.Controls[2].Controls[0]; //Control[0] is a form
I am sure there is a more elegant way...but I'll hit that later. Thanks for
your help!
Jose
>I believe the vb fix would be:
> me.activecontrol = textbob1
[quoted text clipped - 20 lines]
>>
>> Jose