本文介绍了是/否消息框始终返回是-VB.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 我正在尝试使用消息框,并尝试了一个简单的yes / no messagebox ,所以我编写了这段简单的代码。但是,无论我按什么按钮, chc变量始终返回1。我提供了代码,所以您可能会看到我做错了。I was experimenting with message boxes, and tried a simple yes/no messageboxSo I wrote this simple piece of code. However, the "chc" variable always returns as 1, no matter what button I press. I provided the code, so you maybe see what I did wrong. It is probably horribly wrong.If MsgBoxResult.Yes Then chc = 1ElseIf MsgBoxResult.No Then chc = 0End IfMsgBox(chc)推荐答案 MsgBox()方法返回 MsgboxResult 枚举,请检查该方法返回的值:The MsgBox() method is returning MsgboxResult Enumeration, check the value that the method returns:Public Sub MsgBoxExample() Dim result As MsgBoxResult = Nothing Dim chc As Integer result = MsgBox("click something...", vbYesNo, "example") If result = MsgBoxResult.Yes Then chc = 1 ElseIf result = MsgBoxResult.No Then chc = 0 End If MsgBox(chc)End Sub 这篇关于是/否消息框始终返回是-VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-07 23:20