How to set a text box to display multiple lines in VB?

In VB, you can use the TextBox control to set the text box to have multiple lines. First, add a TextBox control to the form. Then, find the Multiline property of the TextBox control and set it to True in the properties window to make the text box have multiple lines. Additionally, you can also decide whether or not to display scroll bars by modifying the ScrollBars property of the TextBox. For example, setting the ScrollBars property to Vertical will display a vertical scroll bar, setting it to Both will display both horizontal and vertical scroll bars. Below is an example code:

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        TextBox1.Multiline = True

        TextBox1.ScrollBars = ScrollBars.Vertical

    End Sub End Class

In this way, TextBox can be set to multiple lines and display a vertical scroll bar.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds