I'm writing a script for a class and I am running into a problem where I am getting the error
"System.NullReferenceException: 'Object variable or With block variable not set.'
Here is the code that I am using to try and get it to write
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
I expect it to save to local drive and be able to recall it with a load function that I will add later.
 
    