Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Registry & File Input / Output

Post new topic   Reply to topic
Reading in line
View previous topic :: View next topic  
Author Message
izur
Newbie


Joined: 10 Sep 2005
Posts: 2

PostPosted: Sep 10th, 2005 02:58 PM    Post subject: Reading in line Reply with quote

Hello all,
I am new here and also a beginner.

I need to read a file which contains float, but i want to read only the second strings of each line. I can read the line, but I have no idea to read only the second string.

Thanks for the answer.

Izp
Back to top
View user's profile Send private message
izur
Newbie


Joined: 10 Sep 2005
Posts: 2

PostPosted: Sep 10th, 2005 03:27 PM    Post subject: Re: Reading in line Reply with quote

For example, my txt file content:
&12
&11
&12,2

And I want to read from the second string only, which results:

12
11
12,2

That's it.

Thanks for the help!
Back to top
View user's profile Send private message
DoobieKeebler
Moderator


Joined: 17 Jun 2005
Posts: 254
Location: 181°15'2.003"W, 93°5'16.956"N

PostPosted: Sep 11th, 2005 03:19 PM    Post subject: Reply with quote

If strVariable is the line you're reading in, then to get everything but the first character then you'd say:

strVariable = Right(strVariable, Len(strVariable) - 1)
_________________
Always take into account what a user would never ever in a million years do, because someone will.

"In theory, there's no difference between theory and practice. In practice, there is." -- Yogi Berra
Back to top
View user's profile Send private message
VB_Developer
Newbie


Joined: 25 Feb 2006
Posts: 18
Location: Hyderabad, India

PostPosted: Feb 27th, 2006 05:56 AM    Post subject: Reply with quote

Hi,
You can even Use fileSystemObject to create, delete, read and write files.

here is a example, how to read from a file using FileSystemObject.....

Code:

Sub ReadFiles
   Dim fso, f1, ts, s
   Const ForReading = 1
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f1 = fso.CreateTextFile("c:\testfile.txt", True)
   ' Write a line.
   f1.WriteLine "Hello World"
   f1.WriteBlankLines(1)
   f1.Close
   ' Read the contents of the file.
   Set ts = fso.OpenTextFile("c:\testfile.txt", ForReading)
   s = ts.ReadLine
   Response.Write "File contents = '" & s & "'"
   ts.Close
End Sub



Hope, this will help you in solving the problems.....

Thanks

Deepak
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Registry & File Input / Output All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic