Search Tools Links Login

VB6 Tutorial 12: Label and TextBox Controls


Some basic properties of Label and TextBox control in Visual Basic 6 are explained in this lesson.

Properties of label

Properties of TextBox

Example Programs

There are four example projects attached at the top of this post that demonstrate some of the available properties.

Note: The Password Program has used msgbox for output. To understand this program, you first need to learn about msgbox which is described in a later lesson.

Run-Time properties of TextBox

Run-time properties are not visible in the Properties Window. You need to write code to set run-time properties.

SelStart

Sets the position of the blinking cursor that appears in the TextBox Control. When the cursor is at the beginning of the text, the value of SelStart is 0. When its at the end of the text, it returns Len(text1.text). 'Len' is a string function that returns the length of the text or the number of characters in the text. Set SelStart property to move the cursor in the TextBox.

Example

Private Sub Form_Load()
    Text1.Text = "Visual" 
    Text1.SelStart = 3
End Sub

Output

event execution

SelLength

Sets the number of characters that has been selected or highlighted.

Example

Private Sub Form_Load()
    Text1.Text = "Visual" 
    Text1.SelLength = 3
End Sub

Output

event execution

SelText

Sets or returns the text that is currently selected or highlighted.

Example

Private Sub Form_Load()
    Text1.Text = "Visual"
    Text1.SelLength = 3
    Text1.Text = Text1.SelText
End Sub

Output

event execution

About this post

Posted: 2018-04-01
By: vb6boy
Viewed: 1,560 times

Categories

Visual Basic 6

VB6 Tutorial

Attachments

ToolTip.zip
Posted: 4/1/2018 10:32:36 AM
Size: 1,091 bytes

Text_display_2.zip
Posted: 4/1/2018 10:32:24 AM
Size: 1,140 bytes

Text_Display_1.zip
Posted: 4/1/2018 10:32:13 AM
Size: 1,110 bytes

Password.zip
Posted: 4/1/2018 10:31:57 AM
Size: 1,240 bytes


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.