05-17-2004, 03:38 PM
Okay, I'm trying to make a little program that outputs some information to a text file.
For example, I have a DateTimePicker that will output the date, I have a few textbox that you can input a names.. Then it will output the in a textfile.
Problem is, I know how to do all of that inside coding, but I have not learned how to 'output' it to a file.
I wanted it to be in a textfile to output like this (EX):
Monday, May 17th, 2004
Something like that.. So I can have logs and keep track of things... Can anyone help me out here?
05-17-2004, 03:51 PM
Oh yeah, and also, how do you reverse it.. from text file back to the program.. So it will output them in text boxes.. :P
I think you should start here:
File I/O In VB.Net (http://www.xtremevbtalk.com/showthread.php?t=148864)
And then come back if you have any questions about it. It's not really something we can teach in a single post, especially with essentially 2 different questions. Read through the tutorial and then take it one step at a time.
05-17-2004, 08:11 PM
Ohh, thanks. Got that working.
But now heres another thing.
here is a piece of what im playing with now:
Dim myReader As New System.IO.StreamReader(myFileStream)
Dim loopy As Integer = 1
Dim f = 2
If loopy = 0 Then Exit Do
'Read the entire text, and set it to a string
Dim sFileContents As String = myReader.ReadLine
Dim sFileContents2 As String = myReader.ReadLine
Dim sFileContents3 As String = myReader.ReadLine
If sFileContents = "" Then
loopy = 0
'Print it to the textbox
txtName1.Text = sFileContents
Dim Timein As Date = sFileContents2
Dim Timeout As Date = sFileContents3
Dim Total As String
Total = Timeout.Subtract(Timein).ToString
txtIn1.Text = Timein.ToLongTimeString
txtOut1.Text = Timeout.ToLongTimeString
txtTotal1.Text = Total
Now... every time I loop, i want the txtIn to raise. there are many txtIn(1,2,3,4,5, etc)...ing .. so if it loops, the next one would be txtIn2, and txtOut2, and so forth. Any help here too?
05-21-2004, 08:35 AM
So do you have a class where an array of text boxes is created? If you don't have some sort of established collection how do you plan on knowing how many text boxes you have..will this number always be the same (such as I have 10 textboxes all named txtIn1-10).
And your original Do Loop here doesn't make a lot of sense to me. You basically loop until a variable is 0. The variable can only be 1 or 0. And if you want to loop until the Reader object is finished reading, how will this correlate with the loop of text boxes you have? You to verify your design and what you really want to do here.