我有一個WinForm,用作只有OK
和Cancel
按鈕的對話框。所以:返回到第一個對話框
Dim sr As New SlideRangeDialog
Dim dr As Windows.Forms.DialogResult
dr = sr.ShowDialog
我有一個如果/然後看看用戶是否按下確定。如果他們按下「確定」並出現驗證錯誤,我需要他們回到對話框並修復它。
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功能區)。
你試過一個While循環嗎? – 2010-11-09 22:44:49