【发布时间】:2018-05-04 16:58:24
【问题描述】:
我一直有关于缩小转换错误的问题
重载解析失败,因为没有缩小转换就无法调用可访问的“显示”:
'Public Shared Function Show(owner As System.Windows.Forms.IWin32Window, text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons) As System.Windows.Forms.DialogResult': 参数匹配参数'owner' 从 'String' 缩小到 'System.Windows.Forms.IWin32Window'。
'Public Shared Function Show(owner As System.Windows.Forms.IWin32Window, text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons) As System.Windows.Forms.DialogResult': 参数匹配参数“caption”从“Microsoft.VisualBasic.MsgBoxStyle”缩小到“String”。
'Public Shared Function Show(owner As System.Windows.Forms.IWin32Window, text As String, caption As String, buttons As System.Windows.Forms.MessageBoxButtons) As System.Windows.Forms.DialogResult': 参数匹配参数“按钮”从“System.Windows.Forms.MessageBoxIcon”缩小到“System.Windows.Forms.MessageBoxButtons”。
'Public Shared Function Show(text As String, caption As String, button As System.Windows.Forms.MessageBoxButtons, icon As System.Windows.Forms.MessageBoxIcon) As System.Windows.Forms.DialogResult': 参数匹配参数“按钮”从“Microsoft.VisualBasic.MsgBoxStyle”缩小到“System.Windows.Forms.MessageBoxButtons”。
我做了一些研究,“重载解析失败,因为没有缩小转换就无法调用可访问的''的通用解决方案:”错误是根据 Microsoft 指定 Option Strict Off。我尝试在项目属性中手动更改它,但它似乎不起作用。
这是发生错误的代码:
If MessageBox.Show("Please Enter a value for ESD (rad)", "ESD (rad) Value", MsgBoxStyle.OkCancel, MessageBoxIcon.Information) = DialogResult.OK Then
txtCal_USE_Radio.Focus()
我还查看了其他几个论坛,他们在其中讨论了此错误,但与“新建”功能特别相关,但似乎没有帮助。
对此的任何帮助都会很棒!
【问题讨论】:
-
错误告诉你什么是错误的 2ce。
Microsoft.VisualBasic.MsgBoxStyle.OkCancel用于旧版MsgBox(),与 Winforms 命名空间中的MessageBoxButtons.OKCancel不同。如果您愿意,Intellisense 将帮助您解决这些问题。请阅读How to Ask 并采取tour