如何从textBox调用MessageBoxButtons.YesNo对话框中的YesNo按钮的事件 [英] how call the event of YesNo button in MessageBoxButtons.YesNo dialog from textBox

查看:390
本文介绍了如何从textBox调用MessageBoxButtons.YesNo对话框中的YesNo按钮的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友:

当我在textBox注销中写入内容时,我只有一个textBox,那时候我调用DialogResult button==messageBox.show("","",MessageBoxButton.YesNo),当我单击yes或no按钮时,出现在我的对话框中的yes按钮和no按钮将执行操作.

我的问题是:当MessageBoxButton.YesNo对话框出现时,我想通过我的textBox文本控制这些YesNo按钮.
示例:当我在textBox.text="yes"中进行写入时,是从MessageBoxButton.YesNo对话框发生的按钮事件,或者如果我在textBox.text="no"中进行写入,则没有按钮事件会执行.我搜索了Google,但没有找到可接受的解决方案.
希望你有身体帮助我.
谢谢.

Dear Friends:

I have one textBox when i write in textBox logOff, that time i call to DialogResult button==messageBox.show("","",MessageBoxButton.YesNo) and it appear to me dialogBox which have yes button and no button when i click yes or no button then action will perform.

My Question is that:when MessageBoxButton.YesNo Dialog appears that time i want to control these YesNo button through my textBox text.
Example: When i write in textBox.text="yes" yes button event occurred from MessageBoxButton.YesNo dialog or if i write in textBox.text="no" No button event become execute. I search Google but i did not find acceptable solution.
Wish you some Body help me.
Thank you.

推荐答案

MessageBox帮助是如此困难吗?!

此问题中的几乎每一行都不正确.

呼叫DialogResult"
:不,您不知道.这是枚举类型的名称.不过,您可以致电MessageBox.Show.

"button == messageBox.show(",",MessageBoxButton.YesNo)" 甚至不会编译. (旁注,请写string.Empty,而不是"".)为什么任何人都应该花时间回答问询者不会打扰拼写代码的问题?!还有,复制和粘贴也是一个问题吗?!

"...出现MessageBoxButton.YesNo对话框时..." 没有此类对话框.

当我用textBox.text="yes" ...编写时..." ,该代码将无法编译,因此进一步的问题没有任何意义.

"MessageBoxButton.YesNo对话框中发生按钮事件"
;不仅仅是按钮事件";没有这样的对话框.

我搜索了Google,但没有找到可接受的解决方案." 是的,因为问题是绝对唯一的.我从没想过有人会问这样的事情,对此文本感到非常惊讶.

我在这里只做一个注释:DialogBox.Show显示一个 modal 对话框.

使用MessageBox很简单,所有帮助都在其中.问题不同:这里没有问题.不仅如此,不仅没有能力提出问题,甚至没有能力实现问题.因此,进一步的细节是没有意义的:1)他们不会回答问题,因为它没有意义; 2)不需要进一步的详细信息,因为每个人都可以在初次阅读帮助后正确使用类MessageBox,而那些罕见的人也不会理解其说明.

在困难的情况下,我通常会提供一般性建议,例如阅读文学作品,做练习等.在这种情况下,我真的不知道该说些什么...

—SA
Is is so difficult to take a look at MessageBox help?!

Almost every line in this Question is incorrect.

"Call to DialogResult"
: no you don''t. This is the name of enumeration type. You can call MessageBox.Show though.

"button==messageBox.show("","",MessageBoxButton.YesNo)" will not even compile. (Side note, write string.Empty, not "".) Why should anyone spend time on answering a Question it the Inquirer does not bother the spell code?! What, copy and paste is a problem, too?!

"...when MessageBoxButton.YesNo Dialog appears..." there is no such dialog.

"When i write in textBox.text="yes"...", the code will not compile, so further question does not make sense.

"button event occurred from MessageBoxButton.YesNo dialog"
; there is no just "button event"; there is no such dialog.

"I search Google but i did not find acceptable solution." Yes, of course, because the Question is absolutely unique. I never would have guessed anyone would ask something like that, was very surprised by this text.

I''ll make only one note here: DialogBox.Show shows a modal dialog.

Using MessageBox is trivial all answers are in it''s help. The problem is different: there is no a Question here. More than that, there is no ability not only to ask a Question but even the ability to realize the problem. So, further detail makes no sense: 1) they won''t answer the Question because it has no sense; 2) further detail are not needed because everyone can use the class MessageBox correctly after first read of the help and those rare people who would not cannot understand the explanation.

In difficult situations, I usually offer general recommendations, like reading literature, doing exercises, etc. In this case I don''t really know what else to say...

—SA



if(MessageBox.show(...)== DialogResult.Yes)...


您可以使用
DialogResult.No
DialogResult.Ok
等等



DialogResult dr = MessageBox.show(...);

开关(dr)
{
案例DialogReslut.No:break;
case DialogReslut.Yes:break;
case DialogReslut.Ok:中断;
}
do
if(MessageBox.show(...)==DialogResult.Yes) ...


you could use
DialogResult.No
DialogResult.Ok
and so on


or
DialogResult dr=MessageBox.show(...);

switch(dr)
{
case DialogReslut.No: break;
case DialogReslut.Yes: break;
case DialogReslut.Ok: break;
}


这篇关于如何从textBox调用MessageBoxButtons.YesNo对话框中的YesNo按钮的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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