在VB6中是否有类似于对话框中的DialogResult的东西?
我有一个 VB6 表单,其中的按钮带有文本“继续”和“取消”。我想检查一下哪一个被点击了。在 C# 中,每个表单都有一个对话框结果,我可以在退出表单之前设置它,具体取决于单击的按钮。我在 VB6 中没有看到这一点。
有对话结果吗?如果不是,检查对话框结果的最佳实践是什么?
I have a VB6 form with buttons with the text 'Continue' and 'Cancel'. I want to check which one was clicked. In C# every form has a dialog result and I could set it before exiting the form depending on which button was clicked. I don't see this in VB6.
Is there a dialog result? If not what is the best practice for checking the dialog result?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在VB6中,对话框通常返回一个整数值,它可能对应于vbYes、vbNo、vbCancel等。
有关详细信息,请参阅本文:http://www.vb6.us/tutorials /理解-msgbox-命令-视觉-基本
http://www.code-vb.com/fragments/Dialogs.htm #Msgbox OK-Cancel
如果您自己创建了表单,则必须在表单上指定它。
这篇文章中的最后一个答案有一个可能有帮助的提示: http:// www.xtremevbtalk.com/archive/index.php/t-306663.html
In VB6 a dialog generally returns an integer value, which may correspond to vbYes, vbNo, vbCancel, etc.
See this article for details: http://www.vb6.us/tutorials/understanding-msgbox-command-visual-basic
http://www.code-vb.com/fragments/Dialogs.htm#Msgbox OK-Cancel
You'll have to specify it on your form if you've created the form yourself.
The last answer in this post has a hint that may help: http://www.xtremevbtalk.com/archive/index.php/t-306663.html
要模拟 .net WinForms 行为,您的表单代码中需要一个辅助函数:
在调用
.Hide()Cancelled
变量code> 或.Close()
,或者您可以有一个直接包含结果代码的变量。To simulate the .net WinForms behaviour, you will need a helper function in your form's code:
The form level
Cancelled
variable can be set by the button event functions before calling.Hide()
or.Close()
, or you could have a variable containing the result code directly.