read characters in a text file using vb


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: read characters in a text file using vb

  1. #1
    Join Date
    Jan 2006
    Posts
    1

    read characters in a text file using vb

    hi
    i am using vb first time. please guide me anyone. i need one program in vb which should read the data in a text file by each character.so please get me the same.thank you.
    nobby.a.p

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Take a look at VB's Input function:
    http://msdn.microsoft.com/library/en...vafctinput.asp
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Aug 2005
    Posts
    19
    Hello,

    Please try the stream reader class.

    Dim sr as IO.Streamreader = IO.File.Opentext("JohnDoefile.txt")

    then read the line

    line 1 = sr.readline

    Hope this helps.

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Boomstick: Questions in the FreeVBCode forums generally pertain to VB6, not .NET.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    I think he need get each character why not try this :

    open "file" for binary access read as #1
    get #1,,var
    close #1

    var contains first char ;

    Inner loop will get the rest while not the file is acceed and not closed yet .

  6. #6
    Join Date
    Nov 2008
    Posts
    1
    Amahdy's response is right.
    One should add a declaration:

    dim var as byte

    to work well.

  7. #7
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,261
    Quote Originally Posted by Phil Weber View Post
    Boomstick: Questions in the FreeVBCode forums generally pertain to VB6, not .NET.
    Oops' this is actually the "VB Classic" forum, which you are correct, is not the .Net forum.
    FreeVBCode.com is the Sample Code Library

Similar Threads

  1. Importing text file using schema.ini
    By Kevin in forum VB Classic
    Replies: 3
    Last Post: 12-05-2005, 06:25 PM
  2. Replies: 1
    Last Post: 03-22-2005, 11:18 PM
  3. Replies: 2
    Last Post: 11-30-2000, 01:17 PM
  4. Replies: 0
    Last Post: 08-22-2000, 10:54 PM
  5. Replies: 0
    Last Post: 04-17-2000, 01:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center