- This topic has 5 replies, 4 voices, and was last updated 18 years ago by Admin.
-
AuthorPosts
-
August 7, 2006 at 5:10 pm #188533Some 1Member
Hey guys
I want to create an instance of System.IO.FileInfo, but i dont know what library to import!! i’m using visual basic 6… does any1 know the full name for it?
any1?
ThanksAugust 9, 2006 at 6:49 pm #188538AdminAdministratorumm man I found this on vbforums.com but i really dont know wha its for 😆
Dim myString As String
Dim input As String
Dim iCount As Integer
Dim theFile As System.IO.FileInfo
Dim re As System.IO.StreamReader
'Open the file to a stream
theFile = New System.IO.FileInfo("C:yourtextfile.txt")
re = theFile.OpenText()
'Read in the first line
input = re.ReadLine()
'Loop through each line
Do While input ""
iCount = iCount + 1
'This will let the first four lines go, then
'it will add the rest of the file to myString.
If iCount > 4 Then
'You can put a return character inbetween these two if you
'want to have a new line for each line added.
myString = myString & input
End If
'Read in the next line for the loop.
input = re.ReadLine()
Loop
'Show your new string.
MessageBox.Show(myString.ToString())August 9, 2006 at 10:26 pm #188537DepartureMemberread the code line for line loco and you will see what its for
August 10, 2006 at 1:15 am #188536AdminAdministratorah does it has to do with system info crap i dont get it 🙄
August 10, 2006 at 4:16 am #188535BattleStar-GalacticaMemberthe namespace says itself fileinfo that’s mean get info about your file but the code u posted is a little bit strange for me, that guys just want to read the text file but he used fileinfo combined with streamreader.
u can create un instance of streamreader by giving your file path
Dim instance As New StreamReader(path)
and …. 🙂 readline readline readline hehehhe
August 10, 2006 at 4:25 am #188534BattleStar-GalacticaMemberah forget to tell you it’s good both. dealing with the file do import system.io namespace to your project.
-
AuthorPosts
Related
- You must be logged in to reply to this topic.