Set TextBox Background Color

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I am treying the change the background color of textboxes that have invalid
data. I am trying the code shown below but when I run it, I get an
exception?

Any thoughts on why this doesn't work?

Wayne

=================================
Dim normColor As Color = System.Drawing.Color.White

txtLastName.BackColor = normColor
 
Hmm, That sounds interesting...

Do it this way.
txtLastName.BackColor = System.Drawing.Color.White

By the way, What is the exception being thrown... Also do post the code..

Happy Coding..
 
It looks like the code is fine - anychance the exception is a
NullReferenceException? If so, I'd make sure txtLastName is actually
attached to a control on the web form.
 
I had a preceding statement that was supposed to be setting the contents of
a text box into a variable and I had left off the ".Text" The exception
really was caused by that. The reported line number was apparently off by 1?

Thanks for the speedy responses.

Wayne
 
Back
Top