C#中的交互式消息框 [英] Interactive messagebox in C#

查看:203
本文介绍了C#中的交互式消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我需要通过ok和取消按钮从messagebox中获取用户的输入。

i不知道如何为此编写代码...可以帮助我

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

推荐答案

for windows forms -

C#中的InputBox [ ^ ]

for webforms -

使用jquery的模态弹出窗口 [ ^ ]

或使用ajax模式弹出扩展器
for windows forms-
InputBox in C#[^]
for webforms-
modal popup using jquery[^]
or use ajax modal popup extender


您好b $ b

您必须设计一个包含OK的获胜表格和取消按钮和一个文本框。

,每次你需要这个消息框你必须从你的表单创建实例并显示给最终用户。



现在,您可以管理用户输入文本做你的行为......



我希望它对你有所帮助。
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.


你应该试试这段代码:



You should try out this code:

<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);
}



这篇关于C#中的交互式消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆