Click here to Skip to main content
11,494,407 members (70,783 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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 17-Dec-12 2:44am
Comments
ryanb31 at 17-Dec-12 8:18am
   
Where are you stuck? What have you done?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Use this

WriteAllText[^]

Thanks.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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

Happy Coding!
Smile | :)
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 443
1 Nakul Chaudhari 240
2 CHill60 230
3 OriginalGriff 225
4 F-ES Sitecore 174
0 Sergey Alexandrovich Kryukov 10,277
1 OriginalGriff 8,805
2 Sascha Lefèvre 3,704
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100