accessing ok.DialogResult inside a function

Posted by sayyad on Stack Overflow See other posts from Stack Overflow or by sayyad
Published on 2011-01-02T22:38:33Z Indexed on 2011/01/02 22:54 UTC
Read the original article Hit count: 148

Filed under:

I am writing function which accepts user input from textbox. Action will take place when ok button is clicked. i made button(DialogResult=OK). code looks like

private void canny()
        {
//
 if (this.DialogResult == DialogResult.OK)
            {
                MessageBox.Show("ok");
}
//to Do
}

But I can't see any messagebox. What I am missing.

 private void ok_Click(object sender, EventArgs e)
        {
// should I add here some thing
        }

Should I add control Form1.Control.Add(Ok)?????????????????? if yes in which part of code. regards,

© Stack Overflow or respective owner

Related posts about c#