Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

Setting focus on a control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jose Rodriguez - 08 Dec 2004 04:07 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.