我正在为VS 2010 Express
使用VB.net
,并想知道是否有一种简单的方法来发现使用IDE可能遇到的异常?
例如,如果我有以下内容:
If Me.saveQueryDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
Try
sqlTextBox.SaveFile(saveQueryDialog.FileName)
Catch ex As Exception
MessageBox.Show(String.Format("Save was unsuccessful encountered: {0}", ex.Message))
End Try
End If
我可以使用IDE以某种方式发现我在这种情况下遇到的常见例外是...ex As IO.IOException
或者在下面:
If Me.openQueryDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Try
sqlTextBox.LoadFile(openQueryDialog.FileName)
Catch ex As Exception
MessageBox.Show(String.Format("Open was unsuccessful encountered: {0}", ex.Message))
End Try
End If
..我遇到的最常见的例外是...ex As IO.FileLoadException
或者我是否需要尝试记住这些特定的例外情况?