TextBox Multiline

xiaoxiao2021-03-06  81

Get or set a value indicating whether or not to type a Tab character in the control in the multi-line text box control, not the focus to the next control in the order of the tab.

[Visual Basic]

Public property acceptstab as boolean

[C #]

Public Bool AcceptStab {Get; SET;

[C ]

Public: __property BOOL GET_ACCEPTSTAB ();

Public: __property void set_acceptstab (bool);

[Jscript]

PUBLIC FUNCTION GET AcceptStab (): boolean;

Public Function Set AcceptStab (Boolean);

Attribute value

If the user can use the Tab key to enter the Tab character in the multi-line text box control, TRUE; if the Tab key moves the focus, it is false. The default is false.

Note

If the AcceptStab property is set to True, the user must press the Ctrl Tab key to move the focus to the next control in the Tab key order.

Example

[Visual Basic, C #] The following example uses derived class TextBox to create a multi-line TextBox control with a vertical scroll. This example also uses AcceptStab, AcceptsReturn, and WordWrap properties to make multiple lines of text box controls to create text documents.

[Visual Basic]

Public Sub CreateMultilineTextBox ()

'Create An Instance of a Textbox Control.

Dim TextBox1 as new textbox ()

'Set The Multiline Property to True.

TextBox1.multiline = true

'Add Vertical Scroll Bars to The Textbox Control.

TextBox1.scrollbars = scrollbars.vertical

'Allow The Return Key in The TextBox Control.

TextBox1.acceptsreturn = TRUE

'Allow the tab key to be entered in the textbox control.

TextBox1.acceptStab = TRUE

'Set Wordwrap to True to allow text to wrap to the next line.

TextBox1.wordwrap = true

'Set the default text of the control.

TextBox1.text = "Welcome!"

End Sub

[C #]

Public void createmultilinetextbox ()

{

// Create An Instance of a TextBox Control.

TextBox textBox1 = new textbox ();

// set The Multiline Property to True.

TextBox1.multiline = true;

// Add Vertical Scroll Bars to the TextBox Control.

TextBox1.scrollbars = scrollbars.vertical;

// allow the return key in the textbox control.

TextBox1.acceptsreturn = true;

// allow the tab key to be entered in The TextBox Control.

TextBox1.acceptstab = true;

// set wordwrap to true to allow text to wap to the next line.

TextBox1.wordwrap = true;

// set the default text of the control.

TextBox1.text = "Welcome!";

}

[C , JScript] No examples of C or JScript. To view the Visual Basic or C # example, click the "Language Filter" button in the upper left corner.

Claim

Platform: Windows 98, Windows NT 4.0, Windows Me, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series, .NET Framework Lite - Windows CE .NET

See

TEXTBOXBASE Class | TextBoxBase Member | System.Windows.Forms Namespace | AcceptsReturn

| TextBoxBase Members (Visual J # Syntax) | C Hosting Extension Programming

Send an opinion about this topic

© 2001-2002 Microsoft Corporation. all rights reserved.

Get or set a value, which indicates that the ENTER button is created in the control in the multi-line TextBox control, and the default button for activating the form is created in the control.

[Visual Basic]

Public property acceptsreturn as boolean

[C #]

Public Bool AcceptsReturn {Get; SET;

[C ]

Public: __property BOOL GET_ACCEPTSRETURN ();

Public: __property void set_acceptsreturn (bool);

[Jscript]

Public Function Get AcceptsReturn (): boolean;

Public Function Set AcceptsReturn (Boolean);

Attribute value

If you create a new line in multi-line versions when you press Enter, you are true; if you activate the default button of the form when you press Enter, it is false. The default is false.

Note

If the value of this property is false, the user must press the Ctrl Enter key to create a new row in the multi-line TextBox control. If the form does not have the default button, you will always create a new line in the control in the control, regardless of the value of the property.

.NET Framework Lite - Windows CE .NET Platform Description: Although AcceptsReturn can be set to false, it is always running as TRUE. If you want to activate a special button using the Enter key, you can derive a class from TextBox and provide an event handler code for the ENTER key when a KeyPress event occurs.

Example

[Visual Basic, C #, JScript] The following example creates a multi-line TextBox control with a vertical scroll bar. This example uses AcceptStab, AcceptsReturn, and WordWrap properties to make multiple lines of text box controls to create text documents. [Visual Basic]

Public Sub CreateMultilineTextBox ()

'Create An Instance of a Textbox Control.

Dim TextBox1 as new textbox ()

'Set The Multiline Property to True.

TextBox1.multiline = true

'Add Vertical Scroll Bars to The Textbox Control.

TextBox1.scrollbars = scrollbars.vertical

'Allow The Return Key to Be Entered in The Textbox Control.

TextBox1.acceptsreturn = TRUE

'Allow the tab key to be entered in the textbox control.

TextBox1.acceptStab = TRUE

'Set Wordwrap to True to allow text to wrap to the next line.

TextBox1.wordwrap = true

'Set the default text of the control.

TextBox1.text = "Welcome!"

End Sub

[C #]

Public void createmultilinetextbox ()

{

// Create An Instance of a TextBox Control.

TextBox textBox1 = new textbox ();

// set The Multiline Property to True.

TextBox1.multiline = true;

// Add Vertical Scroll Bars to the TextBox Control.

TextBox1.scrollbars = scrollbars.vertical;

// allow the return key to be entered in the textbox control.

TextBox1.acceptsreturn = true;

// allow the tab key to be entered in The TextBox Control.

TextBox1.acceptstab = true;

// set wordwrap to true to allow text to wap to the next line.

TextBox1.wordwrap = true;

// set the default text of the control.

TextBox1.text = "Welcome!";

}

[Jscript]

Public function createmultilinetextbox ()

{

// Create An Instance of a TextBox Control.

TextBox1 = new textbox ();

// set The Multiline Property to True.

TextBox1.multiline = true;

// Add vertical scroll bars to the textbox control.textbox1.scrollbars = scrollbars.vertical;

// allow the return key to be entered in the textbox control.

TextBox1.acceptsreturn = true;

// allow the tab key to be entered in The TextBox Control.

TextBox1.acceptstab = true;

// set wordwrap to true to allow text to wap to the next line.

TextBox1.wordwrap = true;

// set the default text of the control.

TextBox1.text = "Welcome!";

}

[C ] No examples of C . To view the Visual Basic, C # or JScript example, click the "Language Filter" button in the upper left corner.

Claim

Platform: Windows 98, Windows NT 4.0, Windows Me, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series, .NET Framework Lite - Windows CE .NET

See

TextBox Class | TextBox Member | System.Windows.Forms Namespace

| TextBox members (Visual J # Syntax) | C hosted extension programming

Send an opinion about this topic

© 2001-2002 Microsoft Corporation. all rights reserved.

Indicates whether multiplexed text box controls are automatically wrap to the next row when necessary.

[Visual Basic]

Public Property WordWrap as Boolean

[C #]

Public Bool WordWrap {Get; SET;

[C ]

Public: __property BOOL GET_WORDWRAP ();

PUBLIC: __Property Void Set_WordWrap (Bool);

[Jscript]

Public Function Get WordWrap (): boolean;

Public Function Set WordWrap (Boolean);

Attribute value

If you are multi-line text box control, true; if the user typed more than the content of the control, the text box control is automatically scrolled, then False. The default is True.

Note

If this property is set to true, the horizontal scroll bar will not be displayed regardless of the setting of the ScrollBars property.

Pay attention to derived class

In TextBox, no matter what this property is set, the text in the control is always wrap, unless it will

TextAlign property is set to

Horizontalalignment.Left.

Example

[Visual Basic, C #] The following example uses derived class TextBox to create a multi-line TextBox control with a vertical scroll. This example also uses AcceptStab, AcceptsReturn, and WordWrap properties to make multiple lines of text box controls to create text documents.

[Visual Basic]

Public Sub CreateMultilineTextBox ()

'Create An Instance of A TextBox Control.dim TextBox1 As New Textbox ()

'Set The Multiline Property to True.

TextBox1.multiline = true

'Add Vertical Scroll Bars to The Textbox Control.

TextBox1.scrollbars = scrollbars.vertical

'Allow The Return Key in The TextBox Control.

TextBox1.acceptsreturn = TRUE

'Allow the tab key to be entered in the textbox control.

TextBox1.acceptStab = TRUE

'Set Wordwrap to True to allow text to wrap to the next line.

TextBox1.wordwrap = true

'Set the default text of the control.

TextBox1.text = "Welcome!"

End Sub

[C #]

Public void createmultilinetextbox ()

{

// Create An Instance of a TextBox Control.

TextBox textBox1 = new textbox ();

// set The Multiline Property to True.

TextBox1.multiline = true;

// Add Vertical Scroll Bars to the TextBox Control.

TextBox1.scrollbars = scrollbars.vertical;

// allow the return key in the textbox control.

TextBox1.acceptsreturn = true;

// allow the tab key to be entered in The TextBox Control.

TextBox1.acceptstab = true;

// set wordwrap to true to allow text to wap to the next line.

TextBox1.wordwrap = true;

// set the default text of the control.

TextBox1.text = "Welcome!";

}

[C , JScript] No examples of C or JScript. To view the Visual Basic or C # example, click the "Language Filter" button in the upper left corner.

Claim

Platform: Windows 98, Windows NT 4.0, Windows Me, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series, .NET Framework Lite - Windows CE .NET

See

TextBoxBase class | TextBoxBase Member | System.Windows.Forms Namespace

| TextBoxBase Members (Visual J # Syntax) | C Hosting Extension Programming

Send an opinion about this topic

转载请注明原文地址:https://www.9cbs.com/read-107078.html

New Post(0)