validation checks in desktop application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • software student
    New Member
    • Jul 2007
    • 10

    validation checks in desktop application

    in windows application i want to apply validation checks.i hv tried one for empty textbox
    i.e.
    if (textBox1.Text == "")
    {
    MessageBox.Show ("Enter phone number", "Error in Input", MessageBoxButto ns.OK, MessageBoxIcon. Information);
    this.textBox1.C lear();
    this.textBox1.F ocus();
    return;
    }
  • Atran
    Contributor
    • May 2007
    • 319

    #2
    Originally posted by software student
    in windows application i want to apply validation checks.i hv tried one for empty textbox
    i.e.
    if (textBox1.Text == "")
    {
    MessageBox.Show ("Enter phone number", "Error in Input", MessageBoxButto ns.OK, MessageBoxIcon. Information);
    this.textBox1.C lear();
    this.textBox1.F ocus();
    return;
    }
    Hello:
    I dont understand what do you want?
    But maybe I can help you, check this link:
    Check if a textbox contains a number..

    Hope I helped you.

    Comment

    • software student
      New Member
      • Jul 2007
      • 10

      #3
      Originally posted by Atran
      Hello:
      I dont understand what do you want?
      But maybe I can help you, check this link:
      Check if a textbox contains a number..

      Hope I helped you.
      :)
      actually i missed lkast sentence that was

      how to validate numbers and alphabetic characters??

      any how..thx alot one of the prb is solved,,numbers are validated now wud u plz do one more favour?
      tell me how to validate text
      (alphabetic characters)

      Comment

      • shahjapan
        New Member
        • Apr 2007
        • 63

        #4
        [CODE=c]
        private void txtPort_Validat ing(object sender, CancelEventArgs e){
        try
        {
        int x = int.Parse(txtPo rt.Text);
        errorProvider1. SetError(txtPor t, "");
        }
        catch (Exception ex)
        {
        errorProvider1. SetError(txtPor t, ex.Message);
        }
        }[/CODE]

        In .NET we have ErrorProvider control tr
        txtPort_Validat ing write this function in your textbox1 validation event.



        [QUOTE=software student]
        Originally posted by Atran
        Hello:
        I dont understand what do you want?
        But maybe I can help you, check this link:
        Check if a textbox contains a number..

        Hope I helped you.[/QU
        :)
        actually i missed lkast sentence that was

        how to validate numbers and alphabetic characters??

        any how..thx alot one of the prb is solved,,numbers are validated now wud u plz do one more favour?
        tell me how to validate text
        (alphabetic characters)

        Comment

        Working...