Results 1 to 7 of 7

Thread: How much can a string variable hold

  1. #1

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    Post

    I found my problem. I am assigning text to a string variable. It seems that the string is not able to hold all the text. Is there a larger variable that can hold text the way I want?
    code except:
    Dim temp As String
    Dim section(150) As String
    Dim i, j, newfile As Integer
    newfile = FreeFile
    Open "c:\temp\999edcs.txt" For Input As newfile
    While Not EOF(newfile)
    Line Input #newfile, temp
    If InStr(temp, ">") And InStr(temp, "<") Then
    List1.AddItem (section(i))
    i = i + 1
    Else:
    section(i) = section(i) & temp & vbCrLf
    End If
    Wend
    For i = 0 To List1.ListCount - 1
    List1.Selected(i) = True
    Next i
    Close newfile
    Text1.Text = "edcs9999.txt"

    ------------------
    I am so skeptacle, I can hardly believe it!

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    A variable Length String can hold Approx' 2 billion Bytes, so I doubt that's your problem.
    Are you getting an Error?
    What are you trying to do?

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

  3. #3

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    Post

    I dont get an error. Does it matter that the variable is a string array?
    my post contains what I am doing with the string variable. Do you think that the problem is when I assign the text to the list box? thank you for your time and have a good day

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    I've run your code with the Textfile you supplied and it works fine, it doesn't lose any data anywhere.
    I think you're misinterpeting the Width of the Listbox as the end of the Sections Text.
    Just because you can't see the full string in the Listbox, doesn't mean it's not there.
    In your Loop, get Debug to Print Each Section No. and the Contents to check for yourself.

    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

  5. #5

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    Post

    I am an idiot! it was not the string but when I assign it to the list box. The listbox is responsible for trimming the text.
    thank you for your time and have a good day

    ------------------
    I am so skeptacle, I can hardly believe it!

  6. #6

    Thread Starter
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    Post

    Can the admin please delete this post I wish that I never started this thread
    thank you

  7. #7
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    1- Please don't feel shammy, (is it spelled that way?)- we all learn from every post
    2- You can delete your post yourself, just click on "edit/delete" (that icon with a little pencil)

    [This message has been edited by Juan Carlos Rey (edited 11-19-1999).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width