how to trap masktextbox control if empty or not filled by user
-
here's my code but its not functioning plz help how to fix this.... i set my masktextbox to filled up telephone number only
private void button1save_Click(object sender, EventArgs e) { if (maskedTextBox2tel.text == string.Empty) { MessageBox.Show("Plz fill up tel No"); maskedTextBox2tel.Focus(); } }
-
here's my code but its not functioning plz help how to fix this.... i set my masktextbox to filled up telephone number only
private void button1save_Click(object sender, EventArgs e) { if (maskedTextBox2tel.text == string.Empty) { MessageBox.Show("Plz fill up tel No"); maskedTextBox2tel.Focus(); } }
crisjala wrote:
here's my code but its not functioning
What is happening, do you see the message box? What are the contents of your variables, have you traced it through with the debugger?
txtspeak is the realm of 9 year old children, not developers. Christian Graus
-
here's my code but its not functioning plz help how to fix this.... i set my masktextbox to filled up telephone number only
private void button1save_Click(object sender, EventArgs e) { if (maskedTextBox2tel.text == string.Empty) { MessageBox.Show("Plz fill up tel No"); maskedTextBox2tel.Focus(); } }
Change it to the static method: String.IsNullOrEmpty(maskedTextBox2tel.text) == true