You can use css if any for checking validation
.newtext
{
border: 1px solid #55aad1;
background: #fff;
color: #333;
font-size: 1.2em;
margin: 5px 0 6px 0;
padding: 5px;
width: 300px;
}
.newtext:focus
{
border: 1px solid #55aad1;
}
.newtext-validation-error
{
border: 1px solid #e80c4d;
background-color: #fc7e7e;
}
and for textbox color change in case of wromg user name or pass use this
textBox.TextChanged += (sender, args) => {
int ignored;
bool valid = int.tryParse(textBox.Text, out ignored);
textBox.ForeColor = valid ? Color.Black : Color.Red;
};