Click here to Skip to main content
12,299,131 members (50,148 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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 1:44am
Comments
ryanb31 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160525.2 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2016
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