Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当用户点击下方 MessageBox 上的“确定”按钮时,会发生一些事情,例如,它会清除 searchResult 字符串并将其设置为“”。澄清一下,会打开一个消息框并显示一些字符串消息(searchResult),但是一旦用户单击该消息框上的“确定”,searchResult 将设置为“”。我怎样才能做到这一点?如何为这个特定消息框的 OK 按钮创建事件处理程序?
if (searchResult != "") { MessageBox.Show(searchResult); }
如果您有兴趣,可以使用它:)
http://msdn.microsoft.com/en-AU/library/system.componentmodel.backgroundworker.runworkercompleted.aspx
不需要听众。调用后立即设置searchResult为空字符串MessageBox.Show:
searchResult
MessageBox.Show
if (searchResult != "") { MessageBox.Show(searchResult); searchResult = ""; }