Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
I have a to create a text File as

Please Help ,am using writeline ,
am passing the Values from Textboxes and then on button click getting the text file.
like in first text am entereing the text "Place:Work!"

and so on please Help .
the structure of my file is
<H>Place: Work!<R>12-12-2012!
<T>student=500L,Size=20L,marks=20R,Roll=40R!
Posted
Updated 7-Jan-18 19:04pm
Comments
ZurdoDev 17-Dec-12 8:18am    
Where are you stuck? What have you done?

Use the TextWriter Class[^].
 
Share this answer
 
Use this

WriteAllText[^]

Thanks.
 
Share this answer
 
Use this...
VB
Dim fPath = "D:\Abc.txt"
Dim afile As New IO.StreamWriter(fPath, True)
afile.WriteLine("hello")
afile.Close()


Happy Coding!
:)
 
Share this answer
 
v2
VB
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Writer As System.IO.StreamWriter
        Writer = New System.IO.StreamWriter("C:\Textfile.txt") '<-- Where to create/write to
        Writer.Write(TextBox1.Text)
        Writer.Close()
        Dim Reader As System.IO.StreamReader
        Reader = New System.IO.StreamReader("C:\Textfile.txt") '<-- where to read from
        Dim tempstring As String
        Do
            tempstring = Reader.ReadLine()
            TextBox1.Text = TextBox1.Text + tempstring + vbLf
        Loop Until tempstring = ""
    End Sub
End Class
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900