未初始化的变量

坏代码

Dim f As System.Windows.Forms.Form
f.ShowModal()

好的代码

Dim f As System.Windows.Forms.Form = New System.Windows.Forms.Form
' Dim f As New System.Windows.Forms.Form ' alternative syntax
f.ShowModal()

更好的代码 (确保正确处理 IDisposable 对象更多信息

Using f As System.Windows.Forms.Form = New System.Windows.Forms.Form
' Using f As New System.Windows.Forms.Form ' alternative syntax
    f.ShowModal()
End Using