hi,
i have 4 textboxes in my project.
if a wrong entry is made in a textbox, then as soon as i move to nexttextbox a error box is displayed. and all the entries should be made serially.
i used enabled key bt in that case mouse cant be used.
then i used foll code:
- private void textBox1_Leave(object sender, EventArgs e)
-
{
-
-
text1();
-
label6.Visible = false;
-
button4.Enabled = true;
-
}
-
public void text1()
-
{
-
if (textBox1.Text == "")
-
{
-
System.Windows.Forms.DialogResult result = MessageBox.Show(this, "Enter tttValue between[ 1 to 3000]", "Start Value error", MessageBoxButtons.OK,
-
MessageBoxIcon.Error);
-
if (result == System.Windows.Forms.DialogResult.OK)
-
textBox1.Focus();
-
return;
-
}
-
s = float.Parse(textBox1.Text);
-
if (!(s > 0 && s < 3000))
-
{
-
System.Windows.Forms.DialogResult result = MessageBox.Show(this, "Enter Value between[ 1 to 3000]", "Start Value error", MessageBoxButtons.OK,
-
MessageBoxIcon.Error);
-
if (result == System.Windows.Forms.DialogResult.OK)
-
textBox1.Focus();
-
return;
-
}
-
-
}
but in this case if i move from textbox2 to textbox1 its not allowing me due to leave func.
so is there any other way i can do that