Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in my project i need to get input from user in messagebox with ok and cancel button..
i dont knw how to write code for that... can u help me
Posted

for windows forms-
InputBox in C#[^]
for webforms-
modal popup using jquery[^]
or use ajax modal popup extender
 
Share this answer
 
Comments
Abhishek Pant 27-Jan-13 9:04am    
Downvoter must see the link then only try to downvote.
Hi
You must design a win form that consist of OK and Cancel Buttons and a text Box.
and every time you need this message Box you must create instance from your form and show to end user.

Now, you can manage your user input text and do your act...

I hope it's helpful for you.
 
Share this answer
 
You should try out this code:

C#
<pre lang="cs">private void button1_Click(object sender, System.EventArgs e)
{
    // This test that the InputBox can handle more newline than one.
    InputBoxResult test = InputBox.Show("Prompt" + "\n" + "DDDD" +
                  "Prompt" + "\n" + "DDDD" +
                  "Prompt" + "\n" + "DDDD" + "Prompt" + "\n" + "DDDD" +
                  "Prompt" + "\n" + "DDDD" +
                  "Prompt" + "\n" + "DDDD"
                  ,"Title","Default",100,0);

    if( test.ReturnCode == DialogResult.OK )
        MessageBox.Show(test.Text);
}

 
Share this answer
 
Comments
Abhishek Pant 27-Jan-13 9:11am    
doesnt worked gives error at InputBoxResult and inputbox. so requires to generate the class.
fjdiewornncalwe 2-Feb-13 11:03am    
Plagiarized from the article link posted by Abhishek Pant in Solution 2.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900