未初始化的變數

壞程式碼

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