Educational Materials like Computer, engineering, software and Property , Entertainment: Change textbox color if textbox is empty in asp.net using c#
Custom Search

Subscribe Now: Feed Icon

February 16, 2012

Change textbox color if textbox is empty in asp.net using c#

Change textbox color if textbox is empty in asp.net using c#

private void button1_Click(object sender, EventArgs e)
{
textBox1.BackColor = Color.White;
textBox2.BackColor = Color.White;
textBox3.BackColor = Color.White;
textBox4.BackColor = Color.White;
string[] text = new string[4];
text[0] = System.Convert.ToString(textBox1.Text);
text[1] = System.Convert.ToString(textBox2.Text);
text[2] = System.Convert.ToString(textBox3.Text);
text[3] = System.Convert.ToString(textBox4.Text);
for (int i = 0; i <= 3; i++)
{
if (text == "")
{
errorshow(i);
}
}
}
private void errorshow(int k)
{
switch (k)
{
case 0:
textBox1.BackColor = Color.Red;
break;
case 1:
textBox2.BackColor = Color.Red;
break;
case 2:
textBox3.BackColor = Color.Red;
break;
case 3:
textBox4.BackColor = Color.Red;
break;
}
}

0 comments:

Post a Comment

Follow by Email

Video Bar

Loading...

Followers

Educational Materials like Computer, engineering, software and Property , Entertainment

Recent Visitors

Active Search Results
Wink Bingo | Slots Tips | Football manager 2010 | blackjack free | Poker Stars
Submitdomainname.com