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 > Code Snippets sample source codes
Change text color in a text box
Change text color in a text box '2 command buttons and 1 text box required Option Explicit Private Declare Function SetSysColors Lib "user32" (ByVal nChanges _ As Long, lpSysColor As Long, lpColorValues As Long) As Long Dim NewColor(0) As Long Dim IndexArray(0) As Long Private Const COLOR_GRAYTEXT = 17 Private Sub Command1_Click() IndexArray(0) = COLOR_GRAYTEXT NewColor(0) = QBColor(Int(Rnd * 16)) SetSysColors 1, IndexArray(0), NewColor(0) End Sub Private Sub Command2_Click() Text1.Enabled = False End Sub
Privacy Policy
|
Link to Us
|
Links