BUG: TextBox does not resize when you set the Anchor property before you set the Multiline property (814344)
The information in this article applies to:
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
SYMPTOMSWhen you set the Multiline property of the TextBox control to True after you set the Anchor property, the TextBox may not resize to the size specified in the Size property of the TextBox. However, the TextBox enables you to enter multiple lines of text.WORKAROUNDTo work around this bug, use one of the following methods:
- Set the Anchor property after you set the Multiline property, as in the following code:
Visual Basic .NET Code'Setting Multiline property
txtBox.Multiline = True
' Setting Anchor property
txtBox.Anchor = AnchorStyles.Top Or AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.Right Visual C# .NET Code// Setting Multiline property
txtBox.Multiline = true;
// Setting Anchor property
txtBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - Set the Size property of the TextBox after you set the Multiline property, as in the following code:
Visual Basic .NET Code' Setting Anchor Property
txtBox.Anchor = AnchorStyles.Top Or AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.Right
' Setting Multiline Property
txtBox.Multiline = true
' Setting the size of the TextBox
txtBox.Size = new System.Drawing.Size(100, 100) Visual C# .NET Code// Setting Anchor Property
txtBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
// Setting Multiline Property
txtBox.Multiline = true;
// Setting the size of the TextBox
txtBox.Size = new System.Drawing.Size(100, 100);
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 2/1/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply KbUIDesign kbWindowsForms kblayout kbForms kbProperties kbBug KB814344 kbAudDeveloper |
---|
|