I'm a newbie so please forgive me if this is a stupid question. I don't understand what I've missed in the code below and how I can get it to work.
I have a few lines of code that works fine. It makes a * show as an error message next to an empty required field:
if (String.IsNullOrEmpty(TextBoxFirstName.Text))
TxtFirstNameReq.Visibility = Visibility.Visible;
else
TxtFirstNameReq.Visibility = Visibility.Collapsed;
but it seems I can't add a line of code like this. I want to show a explanation "*=required field" every time the error message above shows:
if (String.IsNullOrEmpty(TextBoxFirstName.Text))
TxtFirstNameReq.Visibility = Visibility.Visible;
TxtReqField.Visibility = Visibility.Visible;
else
TxtFirstNameReq.Visibility = Visibility.Collapsed;
Error messages:
Line 3 on ';' - "Only assignment, call, increment, decrement, and new object expressions can be used as a statement"
Line 4 - "Invalid expression term 'else'", and "; expected"
Thankful for any help!