|
-
Jun 4th, 2009, 03:22 AM
#1
Thread Starter
Addicted Member
write to text file
Hi
I want to write the user input data to the text file. I want it to be in same line like this
G1 Z1. F80.
If i use my coding like this is not working:
Code:
Dim FILENAME As String = "C:\kaya.txt"
Dim objStreamWriter As StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine("G1 " & TextBox2.Text, "F " & TextBox3.Text)
' Close the stream
objStreamWriter.Close()
if i change it like this :
Code:
objStreamWriter.WriteLine("G1 " & TextBox2.Text)
objStreamWriter.WriteLine("F " & TextBox3.Text)
It become two lines. How can i solve this problem?
Can any one help me.
-
Jun 4th, 2009, 03:38 AM
#2
Re: write to text file
Try this method
Code:
'Open the File for writing
Dim sw As New System.IO.StreamWriter("C:\text.txt", True)
'Write at the end
sw.WriteLine("TEsst1")
'Close the stream
sw.Close()
sw.Dispose()
Please mark you thread resolved using the Thread Tools as shown
-
Jun 4th, 2009, 03:49 AM
#3
Thread Starter
Addicted Member
Re: write to text file
But i want the G1 and F to be in same line not in two lines. Your code still give me a same answer
-
Jun 4th, 2009, 03:57 AM
#4
Re: write to text file
I am not getting you... I think you are dumping forum with Text File question 
Please mark you thread resolved using the Thread Tools as shown
-
Jun 4th, 2009, 07:30 AM
#5
Re: write to text file
Look at the help file on the StreamWriter object, specifically the Write methods. Or do you want someone to write the code for you?
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
-
Jun 4th, 2009, 08:32 AM
#6
Re: write to text file
Try this:
Code:
objStreamWriter.Write("G1 " & TextBox2.Text)
objStreamWriter.Write("F " & TextBox3.Text)
(using objStreamWriter.Write instead of objStreamWriter.WriteLine)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|