Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color change in text entry box to signify mandatory field

Status
Not open for further replies.

STPMB

Programmer
Sep 13, 2002
28
US
This is probably an easy question but before a user can exit a form what code would I use to change the color of a text entry control to notify the user that the field is mandatory?
 
Text1.BackColor=vbRed
Text1.ForColor=vbBlack
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Generally it is done with the forecolor, backcolor, or simply adding the text "required" something like this

Private Sub Command1_Click()
Text1.BackColor = vbRed
Text1.ForeColor = vbBlack
Text1.Text = "Required Field"
End Sub

Hope this helps. If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]

[cheers]
 

That was just an example but I would suggest not using red.
You might want to change the color of the label instead.
Or from the start identify to the user which fields are required by adding an identifier next to the text box, or putting a border around the text box. [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top