VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to set focus on control within tabcontrol when tab changes? Posted by vbn on 14 Dec 2004 at 1:20 PM
I have a tabcontrol with three tabs.

First tab has several controls.
Second tab has only one control.
And the last tab has several controls.

How do I set the focus to a control within a tab when the tab page changes?

Code such as the following did not work for me.

If Me.TabControl1.SelectedIndex = myTabPageTreatment Then
txbVisitTreatment.Focus()
End If

Thanks for all help!!!
vbn

Report
Re: How to set focus on control within tabcontrol when tab changes? Posted by raina245 on 15 Dec 2004 at 6:23 PM
i dont know if this is what u want..but ill try my luck nway.. :)
basically..it's quite easy to set focus on any control...
u just open up the properties window for that particular contol...look for an option of TabIndex..then change the tab index...
set it to 0 for the control that u want to focus immediately as the tab loads and 1 for the next..2..3..and it goes on...
go to the next tab and do the same thing for the controls on it...

hope it helps..

-raina-
Report
Re: How to set focus on control within tabcontrol when tab changes? Posted by vbn on 16 Dec 2004 at 3:03 PM
Thanks Raina

As it turns out I know about this and already have the tab sequence set as desired. I don't want to change the tab sequence (too many tabs with too many controls). I could not manually manage that. What I am looking for is: say you have a tab control with three tabs and each tab has 15 controls, plus labels , etc. When tab 1 is clicked, I want to be able to set the focus to a certain control within the tab. Ditto for tab 2 and tab 3.

I appreciate your being gracious and taking the time to help. Many blessings to you.

Thanks
Vbn

Report
Re: How to set focus on control within tabcontrol when tab changes? Posted by fahimshekaib on 29 Jun 2009 at 7:11 AM
Hello,
You can do it like this.
TablecontrolName.SelectTab(TabPageName)

this way you can programmatically change the table
E.g. you are clicking a button and changes the tab control.
Hope this works, as for me , it did!
Report
Re: How to set focus on control within tabcontrol when tab changes? Posted by shiyasnk on 7 Aug 2010 at 10:40 PM

Suppose If you have One TabControl(Tabcontrol1) and three Tab pages
(TabPage1,TabPage2,TabPage3).

if you are in Tabpage1 and if you want to goto Tabpage3

Code:
------

TabControl1.SelectedTab = TabPage1

txbVisitTreatment.Focus() ' If u want to focus to any control
Report
Re: How to set focus on control within tabcontrol when tab changes? Posted by AnkitLuck on 7 Oct 2011 at 4:33 AM
Hi,
The TabControl is a container control that allows you to display multiple tab on a single form and it allowed switching between the tabs....
for more information check this link...
http://www.mindstick.com/Articles/0f9a1b51-f2e8-4343-ab35-4229f1f19b93/?TabControl%20in%20VB.Net

thanks !!!
Report
This post has been deleted. Posted by AnkitLuck on 7 Oct 2011 at 4:36 AM
This post has been deleted.
Report
This post has been deleted. Posted by AnkitLuck on 7 Oct 2011 at 4:39 AM
This post has been deleted.
Report
This post has been deleted. Posted by AnkitLuck on 7 Oct 2011 at 4:45 AM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.