I got error on following statement in vb.net

Put #1, , Message$

please help me

Regards
Darshana

in .Net we have to first Open the file where we have to put our data
like

Dim FILE_NAME As String = "C:\test2.txt"
 If System.IO.File.Exists(FILE_NAME) = True Then
Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
objWriter.Write(TextBox1.Text)
objWriter.Close()
MsgBox("Text written to file")
Else
MsgBox("File Does Not Exist")
End If

Another one is looping wise

Dim FILE_NAME As String = "C:\test.txt"
Dim i As Integer
Dim aryText(4) As String

aryText(0) = "Mary WriteLine"
aryText(1) = "Had"
aryText(2) = "A"
aryText(3) = "Little"
aryText(4) = "One"

Dim objWriter As New System.IO.StreamWriter(FILE_NAME)

For i = 0 To 4
objWriter.WriteLine(aryText(i))
Next

objWriter.Close()

i think this will help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.