System.IO.FileInfo

You can talk about VB programming here

System.IO.FileInfo

Postby Some 1 » Mon Aug 07, 2006 12:10 pm


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?
Thanks
Some 1
 
Posts: 3
Joined: Mon Jun 19, 2006 4:14 pm

Postby locohacker » Wed Aug 09, 2006 1:49 pm

umm man I found this on vbforums.com but i really dont know wha its for :lol:
Code: Select all
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())
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4364
Joined: Fri Dec 31, 2004 6:59 pm

Postby Departure » Wed Aug 09, 2006 5:26 pm

read the code line for line loco and you will see what its for
User avatar
Departure
Global Moderator
Global Moderator
 
Posts: 996
Joined: Thu Mar 17, 2005 11:26 am
Location: Australia

Postby locohacker » Wed Aug 09, 2006 8:15 pm

ah does it has to do with system info crap i dont get it :roll:
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4364
Joined: Fri Dec 31, 2004 6:59 pm

Postby BattleStar-Galactica » Wed Aug 09, 2006 11:16 pm

the 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
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby BattleStar-Galactica » Wed Aug 09, 2006 11:25 pm

ah forget to tell you it's good both. dealing with the file do import system.io namespace to your project.
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide


Return to Visual Basic Programming

Who is online

Users browsing this forum: No registered users and 0 guests