I am trying to read in te contents of a file to a variable and then pass it on to a textbox, using the code below. However it doesnt seem to work, OpenMode Append or Output i get the error message below. Where as with binary it just freezes.
An unhandled exception of type System.IO.IOException occurred in microsoft.visualbasic.dll
Additional information: Bad file mode.
Private Sub ActivateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ActivateButton.Click
Dim GetTxtFile As String test variable for file get
Writes to file
FileOpen(1, "c:\test.txt", OpenMode.Binary, OpenAccess.Write)
Print(1, "Hello", SPC(20), "Bye")
FileClose(1)
Retrieves the contents of the file to the variable name
FileOpen(2, "c:\test.txt", OpenMode.Binary)
FileGet(2, GetTxtFile)
FileClose(2)
DisplayText.Text = GetTxtFile
End Sub
End Class
Can anyone help me please?
An unhandled exception of type System.IO.IOException occurred in microsoft.visualbasic.dll
Additional information: Bad file mode.
Private Sub ActivateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ActivateButton.Click
Dim GetTxtFile As String test variable for file get
Writes to file
FileOpen(1, "c:\test.txt", OpenMode.Binary, OpenAccess.Write)
Print(1, "Hello", SPC(20), "Bye")
FileClose(1)
Retrieves the contents of the file to the variable name
FileOpen(2, "c:\test.txt", OpenMode.Binary)
FileGet(2, GetTxtFile)
FileClose(2)
DisplayText.Text = GetTxtFile
End Sub
End Class
Can anyone help me please?