How to change the Background of control if Validation failed?(windows forms)

Posted by Sudheep.grandhe under C# on 12/28/2011 | Points: 10 | Views : 1007 | Status : [Member] | Replies : 1
Hi,

I am having the requirment like this.in my form 4 textboxes and one button is there.if the user without entering the details into textboxes.if he clicks on the button.the textbox color has to display some color like red.how can i do this in windows forms.please do the needful.

Best,
Sudheep.



Responses

Posted by: Naraayanan on: 12/29/2011 [Member] Starter | Points: 25

Up
0
Down
button click event:
To check the Textbox is null or Empty
(if Textbox1.text == "" && Textbox2.text == "" && Textbox3.text == ""  && Textbox4.text == "" )

{
//Error Message
}
else
{
// DO something
}
TextBox color:
Textbox1.Backcolor = color.Red


Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response