我不知道如何在ExceptionMessageBox之后跳过操作。在所有情况下,ExceptionMessageBox关闭和主窗体也......: - (
这是我的代码:
Private Sub ConnectCommandButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConnectCommandButton.Click
Dim csr As Cursor = Nothing
Try
csr = Me.Cursor ' Save the old cursor
Me.Cursor = Cursors.WaitCursor ' Display the waiting cursor
bError = False ' Assume no error
' Recreate connection if necessary
If ServerConn Is Nothing Then
ServerConn = New ServerConnection
End If
' Fill in necessary information
ServerConn.ServerInstance = ServerNamesComboBox.Text
' Setup capture and execute to be able to display script
ServerConn.SqlExecutionModes = SqlExecutionModes.ExecuteAndCaptureSql
ServerConn.ConnectTimeout = CType(TimeoutUpDown.Value, Int32)
If WindowsAuthenticationRadioButton.Checked = True Then
' Use Windows authentication
ServerConn.LoginSecure = True
Else
' Use SQL Server authentication
ServerConn.LoginSecure = False
ServerConn.Login = UserNameTextBox.Text
ServerConn.Password = PasswordTextBox.Text
End If
If DisplayEventsCheckBox.CheckState = CheckState.Checked Then
AddHandler ServerConn.InfoMessage, _
AddressOf OnSqlInfoMessage
AddHandler ServerConn.ServerMessage, _
AddressOf OnServerMessage
AddHandler ServerConn.SqlConnectionObject.StateChange, _
AddressOf OnStateChange
AddHandler ServerConn.StatementExecuted, _
AddressOf OnStatementExecuted
End If
' Go ahead and connect
ServerConn.Connect()
SqlServerName = ServerNamesComboBox.Text
MyForm2.ShowDialog()
Close()
Catch ex As Exception
Dim emb As New ExceptionMessageBox(ex)
emb.SetButtonText("Modifier les paramètres et recommmencer", "Abandonner")
emb.Buttons = ExceptionMessageBoxButtons.Custom
emb.DefaultButton = ExceptionMessageBoxDefaultButton.Button1
emb.Show(Me)
bError = True
Select Case emb.CustomDialogResult
Case ExceptionMessageBoxDialogResult.Button1
'TODO Close only ExceptionMessageBox, and go back to main form
Exit Select
Case ExceptionMessageBoxDialogResult.Button2
Me.Close()
End Select
End Try
我想要的是什么:
感谢您的帮助:)!