NET -> Basic Help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: NET -> Basic Help

  1. #1
    Join Date
    Mar 2009
    Posts
    4

    NET -> Basic Help

    In VB6 what would be the equivlant functions for these?

    Dim tmp As New StringBuilder
    Dim f = FreeFile()
    FileOpen(f, strPath, OpenMode.Binary, OpenAccess.Read)

    Dim StrLoc As String = InputString(f, LOF(f))

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Dim f As Integer
    Dim strLoc As String

    f = FreeFile
    Open strPath For Input As f
    strLoc = Input(LOF(f), f)
    Close f
    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
    Mar 2009
    Posts
    4
    Quote Originally Posted by Phil Weber View Post
    Dim f As Integer
    Dim strLoc As String

    f = FreeFile
    Open strPath For Input As f
    strLoc = Input(LOF(f), f)
    Close f
    Run-time error '62'

    Input past end of file

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Hmm, that doesn't make sense. LOF = length of file. You're saying, "Read length-of-file bytes from file handle f into variable strLoc." How can it read past the end of the file if you ask for length-of-file bytes?

    Try changing:

    Open strPath For Input As f

    to:

    Open strPath For Binary As f

    and see if that makes a difference.
    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
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    There has to be something else going on here. This work just fine for me.
    Code:
    Private Sub Command1_Click()
    Dim f As Integer
    Dim strLoc As String
    Dim strPath As String
    
    strPath = "d:\devtest.txt"
    
    f = FreeFile
    Open strPath For Input As f
    strLoc = Input(LOF(f), f)
    Close f
    End Sub
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  6. #6
    Join Date
    Mar 2009
    Location
    Italy - Breganze (VI)
    Posts
    120
    Phil is right.

    Code:
    FileOpen(f, strPath, OpenMode.Binary, OpenAccess.Read)
    in VB 6.0 mean

    Code:
    Open strPath For Binary As f
    HTH

Similar Threads

  1. Serious problem with a website!
    By Loham in forum Java
    Replies: 1
    Last Post: 06-13-2008, 09:11 AM
  2. Replies: 0
    Last Post: 06-29-2005, 05:30 PM
  3. .NOT vs .NET
    By Robert Lantry in forum .NET
    Replies: 88
    Last Post: 04-05-2002, 08:03 AM

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