By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,984 Members | 2,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,984 IT Pros & Developers. It's quick & easy.

Textfile & Arrays

P: 1
Can you help me how to use textfile step by step process and showing how to use the object?
removed mail id
We have no enough to to do our program csn you please teah us?
removed mail id
Jan 11 '08 #1
Share this Question
Share on Google+
1 Reply


jamesd0142
100+
P: 469
you will need to add this above the class declaration:
Expand|Select|Wrap|Line Numbers
  1. imports system.io
  2.  
Then edit the following functions to you needs:
Expand|Select|Wrap|Line Numbers
  1. Private Sub createTextFile()
  2.         Dim oTxtWriter As New StreamWriter(path1)
  3.         oTxtWriter.WriteLine("This is a line")
  4.         oTxtWriter.Flush()
  5.         oTxtWriter.Close()
  6.     End Sub
  7.  
  8.     Private Sub WriteFile()
  9.         'can use .append instead of .output
  10.         Dim Date1 As String = Format$(Now)
  11.         Dim Date2 As String = Mid(Date1, 1, 10)
  12.         FileOpen(1, "C:\text123412.txt", OpenMode.Output)
  13.         Print(1, Date2) ', Environment.NewLine)
  14.         FileClose(1)
  15.     End Sub
  16.  
  17.     Function Readfile(ByVal abc)
  18.         Dim EntireLine As String
  19.         Dim oFile As System.IO.File
  20.         Dim oRead As System.IO.StreamReader
  21.         oRead = oFile.OpenText("C:\text123412.txt")
  22.         EntireLine = oRead.ReadToEnd
  23.         oRead.Close() 'test line
  24.         Return EntireLine
  25.     End Function
  26.  
There are much better ways to do this but they work so i use them.

Thanks James
Jan 11 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.