How to let the user press Ctrl-A to select all of the text in a TextBox in Visual Basic 6.
Method 1
Private Sub Text1_KeyPress(KeyAscii As Integer)
Const CTRL_A As Integer = 1
If KeyAscii = CTRL_A Then SelectAllTextBox Text1
End Sub
Private Sub SelectAllTextBox(ByVal txt As TextBox)
txt.SelStart = 0
txt.SelLength = Len(txt.Text)
End Sub
Method 2
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = vbCtrlMask And KeyCode = vbKeyA Then
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End If
End Sub
Visual Basic Classic, Visual Basic 6, Programming Language
Bibliography:
https://www.petanikode.com/,https://www.codecademy.comRelated Post:
- Visual Basic KeyCode Constants Reference
- Visual Basic KeyAscii
- Visual Basic TextBox
- Label Control Properties In Visual Basic 6
- Microsoft Visual Basic 6 Data Binding Object
- Topic about Visual Basic 6 ( VB 6 )
- Visual Basic (VB6) CRUD with Ms Access Database Code
- Visual Basic Variable Keywords 1
- Error Handling In Visual Basic
- Most Common Chr Code In Visual Basic
- Default Value Of Data Types In Visual Basic 6
- Visual Basic Intrinsic Controls
- Visual Basic 6 Data Type Function
- Visual Basic Error Codes
- Visual Basic 6 Menu
- PHP Requirements
- HTML White Space 1
- Most Java Exception 1
- Circle Element
Tidak ada komentar:
Posting Komentar