Hey everyone, I was just wondering if someone could help me with this lame string problem. Basically I copied this code from an application I made in VBA Excel and am now just reusing it for a Standard VB executable.

Ok here is the Function, it basically just returns all the code from a web page that I ask it to get. sReadBuffer basically reads in the page chunk by chunk and then it get appended to another string sBuffer.

Code:
Public Function grabWebpage(passedURL As String) As String

    Dim newlinePosition     As Integer
    Dim hOpen               As Long
    Dim hOpenUrl            As Long
    Dim sURL                As String
    Dim LineBuffer          As String
    Dim bDoLoop             As Boolean
    Dim bRet                As Boolean
    Dim sReadBuffer         As String * 2048
    Dim lNumberOfBytesRead  As Long
    Dim sBuffer             As String

    LineBuffer = ""
    testLineCounter = 0
    
  
 '   If (testURL(passedURL) = False) Then
 '       MsgBox "Unable to connect to Webpage: " + passedURL
 '       grabWebpage = ""
 '       Exit Function
 '   End If
    
    hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
    hOpenUrl = InternetOpenUrl(hOpen, passedURL, vbNullString, 0, INTERNET_FLAG_NO_COOKIES, 0)

    bDoLoop = True
'    Application.ScreenUpdating = True
    While (bDoLoop)
        sReadBuffer = vbNullString
        bRet = InternetReadFile(hOpenUrl, sReadBuffer, Len(sReadBuffer), lNumberOfBytesRead)
        
        sBuffer = sBuffer & Left$(sReadBuffer, lNumberOfBytesRead)
        If Not CBool(lNumberOfBytesRead) Then
            bDoLoop = False
        End If
    Wend
      
    grabWebpage = sBuffer
    
    Dim handleCloseReturn As Boolean
    If (hOpenUrl <> 0) Then
        handleCloseReturn = InternetCloseHandle(hOpenUrl)
    End If
    If (hOpen <> 0) Then
        handleCloseReturn = InternetCloseHandle(hOpen)
    End If
    
End Function

Oh yea, and in case you didn't know, the $Left statement is used to trim the sReadBuffer so that only what was read in gets appended to the sBuffer... taking out the blank left over space on the end of the string.

I watched this thing step through for a while and my InternetReadFile function is working perfectly... stepping through the page as it should.... but for some reason the string sBuffer wont grow in size from the inital copy of sReadBuffer. (basically it only copies the string on the first time thru).

Thanx in advance to everyone!