Hi I am trying to set the visibility of a label based on a textbox string being empty. I have the following code:
MyLabel.Visible = String.IsNullOrEmpty(MyTextBox.Text);
Why does MyLabel not appear when the textbox is left empty?
Update
I have tried placing this code in the Text_Changed event of the textbox and it still doesn't work.
This was an update issue, it does work on the Text_Changed event. However the issue is it does not work when triggered on the proccessing of the form.
Here is the code triggered from my controller class to give everyone a better insight as to what is going on:
using (var frm = new frmAdd(PersonType.Carer))
{
var res = frm.ShowDialog();
if (res == System.Windows.Forms.DialogResult.OK)
{
if (frm.ValidateInformation()) // the above code is called in here
{
// process the information here...
}
}
}
Also I forgot to mention that this form is in a Class Library project (dll).