|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can't set focus to controls on TabPagecontrol, 3 tab pages and a text box on each tab page. I expected the following to set focus to the text box on the selected tab page but it does not. Private Sub TabControl1_SelectedIndexChanged(...etc Select Case TabControl1.SelectedIndex Case 0 txtBox1.Focus() Case 1 txtBox2.Focus() Case 2 txtBox3.Focus() End Select End Sub CanFocus is false for the tab page and the text box while in the sub. TabControl1.SelectedTab = TabPage1 before txtBox1.Focus() doesn't help either. What am I missing? Thanks is this code in your page load even by any chance? because it wont work
there Show quoteHide quote "Paul Close" <supp***@computerdoctor.com.au> wrote in message news:O0KHtfqPFHA.1476@TK2MSFTNGP09.phx.gbl... >A new solution/project consisting of a single windows form with a tab >control, 3 tab pages and a text box on each tab page. I expected the >following to set focus to the text box on the selected tab page but it does >not. > > Private Sub TabControl1_SelectedIndexChanged(...etc > Select Case TabControl1.SelectedIndex > Case 0 > txtBox1.Focus() > Case 1 > txtBox2.Focus() > Case 2 > txtBox3.Focus() > End Select > End Sub > > CanFocus is false for the tab page and the text box while in the sub. > TabControl1.SelectedTab = TabPage1 before txtBox1.Focus() doesn't help > either. > > What am I missing? > > Thanks > It's the tab control SelectedIndexChanged event handler. No other user
entered code in the project. Show quoteHide quote "Brian Henry" <brianiupmsdn@newsgroups.nospam> wrote in message news:uo0EjjqPFHA.648@TK2MSFTNGP14.phx.gbl... > is this code in your page load even by any chance? because it wont work > there > > > "Paul Close" <supp***@computerdoctor.com.au> wrote in message > news:O0KHtfqPFHA.1476@TK2MSFTNGP09.phx.gbl... >>A new solution/project consisting of a single windows form with a tab >>control, 3 tab pages and a text box on each tab page. I expected the >>following to set focus to the text box on the selected tab page but it >>does not. >> >> Private Sub TabControl1_SelectedIndexChanged(...etc >> Select Case TabControl1.SelectedIndex >> Case 0 >> txtBox1.Focus() >> Case 1 >> txtBox2.Focus() >> Case 2 >> txtBox3.Focus() >> End Select >> End Sub >> >> CanFocus is false for the tab page and the text box while in the sub. >> TabControl1.SelectedTab = TabPage1 before txtBox1.Focus() doesn't help >> either. >> >> What am I missing? >> >> Thanks >> > > You were on the right track Brian. Thanks. The tab control
SelectedIndexChanged event fires before the first form Load event so nothing can recieve focus. Show quoteHide quote "Paul Close" <supp***@computerdoctor.com.au> wrote in message news:OiHQ1oqPFHA.3384@TK2MSFTNGP10.phx.gbl... > It's the tab control SelectedIndexChanged event handler. No other user > entered code in the project. > > "Brian Henry" <brianiupmsdn@newsgroups.nospam> wrote in message > news:uo0EjjqPFHA.648@TK2MSFTNGP14.phx.gbl... >> is this code in your page load even by any chance? because it wont work >> there >> >> "Paul Close" <supp***@computerdoctor.com.au> wrote in message >> news:O0KHtfqPFHA.1476@TK2MSFTNGP09.phx.gbl... >>>A new solution/project consisting of a single windows form with a tab >>>control, 3 tab pages and a text box on each tab page. I expected the >>>following to set focus to the text box on the selected tab page but it >>>does not. >>> >>> Private Sub TabControl1_SelectedIndexChanged(...etc >>> Select Case TabControl1.SelectedIndex >>> Case 0 >>> txtBox1.Focus() >>> Case 1 >>> txtBox2.Focus() >>> Case 2 >>> txtBox3.Focus() >>> End Select >>> End Sub >>> >>> CanFocus is false for the tab page and the text box while in the sub. >>> TabControl1.SelectedTab = TabPage1 before txtBox1.Focus() doesn't help >>> either. >>> >>> What am I missing? >>> >>> Thanks >>> >> >> > >
Dragging a mail from Outlook/Outlook Express in to a .NET VB app
DataGrid Bind to DataSet, then Bind to DaTaview, GOT ERROR...PLS HELP File pointer to be positioned at the last occurance of a keyword How to back up an object... Lines and Boxes in VB.Net Newbie VB Question MDIChild form controls: how to pass information between them? Connectionstring Unexpected behaviour of MyClass (please ignore 1st post) Why use Dim outside of sub? |
|||||||||||||||||||||||