我有一个 WinForm 用作带有按钮OK
的对话框。Cancel
所以:
Dim sr As New SlideRangeDialog
Dim dr As Windows.Forms.DialogResult
dr = sr.ShowDialog
我有一个 If/Then 来查看用户是否按下了 OK。如果他们按下 OK 并且出现验证错误,我需要他们返回对话框并修复它。
If dr = Windows.Forms.DialogResult.OK Then
Dim mr As Windows.Forms.DialogResult
mr = MsgBox("Click Yes to fix, No to not fix or Cancel to go " + vbCrLf + _
" back to the dialog to fix.", MsgBoxStyle.YesNoCancel)
Select Case mr
Case Windows.Forms.DialogResult.Yes
''# something
Case Windows.Forms.DialogResult.No
''# something more
Case Windows.Forms.DialogResult.Cancel
''# RIGHT HERE is where I'm having the problem.
''# I just want "Cancel" to return to the first dialog.
sr.DialogResult = Windows.Forms.DialogResult.None
End Select
Else
''#other thing
End If
我会放什么让Case Windows.Forms.DialogResult.Cancel
我回到第一个对话框,因为sr.DialogResult = Windows.Forms.DialogResult.None
它似乎不起作用?
我已经尝试再次引发事件子(它是从菜单项中单击),但这不适用于我正在使用的技术(VSTO 功能区)。