Hello All, I have a simple program with several textbox's, I have an InputBox that sets the name and destination of the file that I am creating. My problem is the text entries are not being written. The file is created and sored in its location 'C:/temp/HectorBBB.txt and by name. But when I review the file it is blank.
Sub SaveDocument()
' Dim inputFile As StreamReader
Dim strEmployeeData As String
Dim outputFile As StreamWriter ' Object variable
strEmployeeData = InputBox("enter a file name")
Try
'create the file
outputFile = File.CreateText(strEmployeeData)
'Write the TextBox to the file.
outputFile.WriteLine(txtFirstName.Text)
outputFile.WriteLine(txtMiddleName.Text)
outputFile.WriteLine(txtLastName.Text)
outputFile.WriteLine(txtEmployeeNumber.Text)
outputFile.WriteLine(ComboDepartment.Text)
outputFile.WriteLine(txtTelephone.Text)
outputFile.WriteLine(txtExtension.Text)
outputFile.WriteLine(txtEmail.Text)
'Close the file.
outputFile.Close()
'update the isChnaged variable.
' blnIsChanged = False
Catch ex As Exception
'Error message for the file creation error.
MessageBox.Show("Error creating the file.")
End Try
End Sub
Please provide suggestions or advise, thank you.
