473,795 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Focus to textbox on tab control

VS 2005

On a form I have a tabcontrol with 5 tabs. Each tab has three textboxes on
it. When I click on each tab, I would like to have the focus set to the
first textbox.

On the tabenter event for each tab, I put a textbox1.focus but the textbox
doesn't contain the cursor.

How can I do this?

Oct 6 '06 #1
3 6773
Try putting it in the click event of the tabcontrol. Just verify the
index of the selected tab, then focus on the appropriate textbox.

Tom

Henry Jones wrote:
>VS 2005

On a form I have a tabcontrol with 5 tabs. Each tab has three textboxes on
it. When I click on each tab, I would like to have the focus set to the
first textbox.

On the tabenter event for each tab, I put a textbox1.focus but the textbox
doesn't contain the cursor.

How can I do this?


Oct 6 '06 #2
I wanted the textbox to have the focus when the tab appears in front. I
have already clicked on the tab label at the top and when I put the focus in
the click event on the tab, your suggestion works, but I might as well have
clicked in the textbox!

I would like to have focus on the textbox when the tab appears. Any
suggestions?

Thanks

H
"tomb" <to**@technetce nter.comwrote in message
news:3R******** ***********@big news8.bellsouth .net...
Try putting it in the click event of the tabcontrol. Just verify the
index of the selected tab, then focus on the appropriate textbox.

Tom

Henry Jones wrote:
>>VS 2005

On a form I have a tabcontrol with 5 tabs. Each tab has three textboxes
on it. When I click on each tab, I would like to have the focus set to
the first textbox.

On the tabenter event for each tab, I put a textbox1.focus but the textbox
doesn't contain the cursor.

How can I do this?


Oct 6 '06 #3
On Fri, 6 Oct 2006 15:07:07 -0700, "Henry Jones" <he***@yada.com wrote:
>I wanted the textbox to have the focus when the tab appears in front. I
have already clicked on the tab label at the top and when I put the focus in
the click event on the tab, your suggestion works, but I might as well have
clicked in the textbox!

I would like to have focus on the textbox when the tab appears. Any
suggestions?

Thanks

H
You would need to get the child index of the first textbox on each page before you
can set it's focus:

With Me.TabControl1. SelectedTab
.Controls(.Cont rols.GetChildIn dex(Me.SomeText Box)).Focus()
End With

In the TabControl SelectedIndexCh anged event, identify the selected tab and then
setup a Select Case statement for the 5 tabs to specify which patricular textbox
reference goes into the above code.

Gene

>

"tomb" <to**@technetce nter.comwrote in message
news:3R******* ************@bi gnews8.bellsout h.net...
>Try putting it in the click event of the tabcontrol. Just verify the
index of the selected tab, then focus on the appropriate textbox.

Tom

Henry Jones wrote:
>>>VS 2005

On a form I have a tabcontrol with 5 tabs. Each tab has three textboxes
on it. When I click on each tab, I would like to have the focus set to
the first textbox.

On the tabenter event for each tab, I put a textbox1.focus but the textbox
doesn't contain the cursor.

How can I do this?

Oct 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
3865
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a record to the subform (based on the value of the combo box) and requeries the subform control. I want the focus to return to the combo box on the main form when it's done, but I can't get it to do so if the user enters a value and presses Enter...
0
5084
by: Miquel | last post by:
Hi all. I felt frustrated when developing an 'UserControl' derivated from textBox, because sequence event (and Validate event) seems to fail. I Always thought my code was wrong. But after trying the UserControl a lot of hours I have the feeling that c# (or .Net) fails. Thus, I have developed a simple program with 3 textBox, 1 Botton and 1 ListBox (for showing results) which fire OnEnter, OnGotFocus,
4
2786
by: Jerry Camel | last post by:
Once the datalist is in edit mode and the text boxes and all happily appear, how can I force the textbox to be the control with focus, so the user can start editing without having to click the textbox first? Thanks. Jerry
1
2063
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
1
5138
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
3
2825
by: vivela | last post by:
hi, I hope you could help me out on this one,cause I have been trying for 4 days to solve it,but couldn't quite get it right: I have an ASP textbox that should change the value in a dropdownlist. this happens,but the problem is with the validation of the ddl.it has a requiredfieldvalidator,and the error message disapears only if i select a value from the dropdownlist,even though it should also disapear when I write a valid name in the...
1
2516
by: Praveena.Alapati | last post by:
Hi, There is a tab control on a page with multiple tabs and handful of controls in each tab. The way it's rendered in html (like grid etc..) is in table format in tablerows and cells. On clientside, on form validation in javascript, I would like to set focus on to one of the tabs and set the focus to the control on that tab.
3
5198
by: jp2express | last post by:
I have several applications that use panels as screens, but I can *not* seem to set the focus for a Textbox. Panel1.BringToFront() Panel1_Textbox.Focus() ' do something with a control on Panel1 Panel2.BringToFront() Panel2_Textbox.Focus() ' do something with a control on Panel2
8
6904
by: Mel | last post by:
I have several text boxes and drop-down lists in an AJAX Update Panel. All user inputs have the Postback property set to True. After I type something in the first input entry and press the "Tab" key how can I set the focus to the next box after the postback? Please help! Using Visual Studio 2005 Pro, Asp.net 2.0, vb.net, WinXP
10
10049
by: Derek Hart | last post by:
I can set focus to my property grid by using propgrid.Focus - but how can I set the default property that is always first? Or just set focus to the default property? Can this be done?
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10448
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10167
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.