Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows
Visual Basic > ActiveX Controls sample source codes
Highlight all text in textbox
Highlight all text in textbox 'Here is the main function that controls 'the highlighting of all text in a textbox. 'Additional commands can be added to this function 'to perform any other functions during a gotfocus 'event. Public Function txtGotFocus() Dim obj Set obj = Form1.ActiveControl If TypeOf obj is TextBox Then obj.SelStart = 0 obj.SelLength = Len(obj.Text) End if End Function 'Here is an example of how to reference the 'function in a textbox GotFocus() event. Private Sub Text1_GotFocus() txtGotFocus End Sub
Privacy Policy
|
Link to Us
|
Links