Example of multiline TextBox

Example of multiline TextBox


TextBox With the multi lines of TextBox, the user is able to insert text on multiple lines. The TextBox control. NET Framework in Visual Basic or C #. To make your TextBox as complete as possible, here is a small set of properties to use:
Example of multiline TextBox



AcceptsReturn
Users use the Enter button to change line (carriage return). By default, this option is disabled and you must go to: True.

AcceptsTab
Tabs enrich the paragraph. No tabs, use must use space to start a paragraph. This option must be set to True.

Multiline
Obviously, Multiline to True.

ScrollBars
If the number of rows is large, vertical ScrollBars will be very helpful.


Here is a simple example from MSDN. Download the sample project available at the end of this article.


Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms

Public Class Form1
    Inherits Form

    Dim textBox1 As TextBox

    Public Sub New()
        InitializeComponent()
    End Sub 

    Private Sub InitializeComponent()

        Me.textBox1 = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        '  
        ' textBox1 
        '  
        Me.textBox1.AcceptsReturn = True 
        Me.textBox1.AcceptsTab = True 
        Me.textBox1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.textBox1.Multiline = True 
        Me.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        '  
        ' Form1 
        '  
        Me.ClientSize = New System.Drawing.Size(284, 264)
        Me.Controls.Add(Me.textBox1)
        Me.Text = "TextBox Example" 
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub 

End Class


Reference :



0 Response to "Example of multiline TextBox"

Posting Komentar