我正在为一个类编写脚本,但遇到了遇到错误的问题
“ System.NullReferenceException:'对象变量或未设置块变量。'
这是我用来尝试编写的代码
Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem6.Click
If SaveDialog.ShowDialog(txtScanNumber.Text) = DialogResult.OK Then
Dim fileName As String = SaveDialog.FileName
Dim sFile As New System.IO.FileStream(fileName,
System.IO.FileMode.Create)
Dim wFile As New System.IO.StreamWriter(sFile)
wFile.Write(txtScanNumber.Text)
wFile.Close()
End If
End Sub
我希望它可以保存到本地驱动器,并能够使用稍后将添加的加载功能对其进行调用。