BUG: A control on the hidden TabPage is not visible when you use the Control.Select method or the Form.ActiveControl property in Visual Basic .NET or in Visual C# .NET (820629)
The information in this article applies to:
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual C# .NET (2003)
- Microsoft Visual C# .NET (2002)
SYMPTOMSYou may have a TabControl control on a Windows Form. You may
add controls to the TabPages property of the TabControl. When you use the Form.ActiveControl property or the Control.Select method to set the focus for the control on the hidden TabPages, the focus is moved to the control. However, you cannot see the
control.RESOLUTIONTo resolve the problem, select the hidden TabPages on the TabControl, and then follow these steps:
- Replace the existing code in the Button1_Click event handler with the following code:
Visual Basic .NET Code'Select TabPage2.
TabControl1.SelectedTab = TabPage2
Console.WriteLine("call TextBox2.Select()")
'Select TextBox2 on TabPage2.
TextBox2.Select()
'Display the name of the current ActiveControl.
Console.WriteLine("Form.ActiveControl after Select: " + Me.ActiveControl.Name) Visual C# .NET Code//Select TabPage2.
tabControl1.SelectedTab =tabPage2;
Console.WriteLine("call textBox2.Select()");
//Select textBox2 on TabPage2.
textBox2.Select();
//Display the name of the current ActiveControl.
Console.WriteLine("Form.ActiveControl after Select: " + this.ActiveControl.Name); - Replace the existing code in the Button2_Click event handler with the following code:
Visual Basic .NET Code 'Select TabPage2.
TabControl1.SelectedTab = TabPage2
Console.WriteLine("set Form.ActiveControl = TextBox2")
'Set TextBox2 as the ActiveControl.
Me.ActiveControl = TextBox2
'Display the name of the current ActiveControl.
Console.WriteLine("Form.ActiveControl after set: " + Me.ActiveControl.Name) Visual C# .NET Code//Select TabPage2.
tabControl1.SelectedTab =tabPage2;
Console.WriteLine("set Form.ActiveControl = textBox2");
//Set textBox2 as the ActiveControl.
this.ActiveControl = textBox2;
//Display the name of the current ActiveControl.
Console.WriteLine("Form.ActiveControl after set: " + this.ActiveControl.Name); - On the Debug menu, click
Start.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbWindowsForms kbTabCtrl kbCtrl kbControl kbbug KB820629 kbAudDeveloper |
---|
|