Вопрос по windows, c#, textbox – Проверка WinForms TextBox (в C #)

0

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded Fredou
Error: User Rate Limit Exceeded Hemant
Error: User Rate Limit Exceeded Ahmed Said

Ваш Ответ

4   ответа
1

  private void textBox1_Validating( object sender, CancelEventArgs e )
  {
      if ( textBox1.Text == "3" )
          e.Cancel = true;
  }

1

 private void textBox1_Leave(object sender, EventArgs e)
    {
        TextBox tb = (TextBox)sender;

        if (tb.Text == "3")
            tb.Focus();
    }

Error: User Rate Limit Exceeded
1

Masked TextBox

0

Validating WinForms TextBox

Create a function:

public static void ChkBlankTextBoxes(object sender, string type)
{

    if (sender is TextBox)
    {
        TextBox textbox = sender as TextBox;
        if (string.IsNullOrEmpty(textbox.Text))
        {
            MessageBox.Show("Please enter correct value value..");
            textbox.Focus();

        }
    }
}

Call to created function:

ChkBlankTextBoxes(txt_userID, textBoxtype);

ChkBlankTextBoxes(txt_password, textBoxtype);

Похожие вопросы