Strange string limit problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xyz

    Strange string limit problem


    I have a form that has a text box that allows multi-line text. When I
    read an 80K file into it, only 64K characters are stored and
    displayed. However, if I copy from the 80K file using the Windows
    clipboard commands and then paste into the text box, all the
    characters are stored and displayed.

    This is how I read the file into the text box. It works fine until
    the file exceeds 64K.

    F = FreeFile
    Open "tagtmp2.tm p" For Input As F
    frmForm1!txtEdi t.Text = Input(LOF(F), F)
    Close F

    I have tried reading the file with LINE INPUT # into a string or
    variant variable and then tried to assign the string to the text box
    variable. E.g, txtEdit.Text = MyData and it also gets truncated.
    This also happens concatenating character-by-character.

    Since pasting into the text box works fine, I am assuming that I
    should be able to store 2^32 characters into the txtEdit.Text string
    as defined for VB for a varying string. The fact that only 2^16
    characters are stored means that the text box is being interpreted as
    a fixed string which has this smaller limit.

    Does anybody know how to do this?

    Thanks,
    xyz

  • Randy Birch

    #2
    Re: Strange string limit problem

    While strings can be 2^32 characters, edit controls (text boxes) are limited
    to 64k.



    --

    Randy Birch
    MVP Visual Basic

    Please respond only to the newsgroups so all can benefit.


    "xyz" <xyz@mailinator .com> wrote in message
    news:04mnqvsq6t qt3hdlla8nqk8np kshk77s91@4ax.c om...
    :
    : I have a form that has a text box that allows multi-line text. When I
    : read an 80K file into it, only 64K characters are stored and
    : displayed. However, if I copy from the 80K file using the Windows
    : clipboard commands and then paste into the text box, all the
    : characters are stored and displayed.
    :
    : This is how I read the file into the text box. It works fine until
    : the file exceeds 64K.
    :
    : F = FreeFile
    : Open "tagtmp2.tm p" For Input As F
    : frmForm1!txtEdi t.Text = Input(LOF(F), F)
    : Close F
    :
    : I have tried reading the file with LINE INPUT # into a string or
    : variant variable and then tried to assign the string to the text box
    : variable. E.g, txtEdit.Text = MyData and it also gets truncated.
    : This also happens concatenating character-by-character.
    :
    : Since pasting into the text box works fine, I am assuming that I
    : should be able to store 2^32 characters into the txtEdit.Text string
    : as defined for VB for a varying string. The fact that only 2^16
    : characters are stored means that the text box is being interpreted as
    : a fixed string which has this smaller limit.
    :
    : Does anybody know how to do this?
    :
    : Thanks,
    : xyz
    :


    Comment

    • xyz

      #3
      Re: Strange string limit problem

      I was able to go beyond the 64K limit by changing my controls.

      Yes, it is true that the Text Box control has a 64K limit, but the
      Rich Text Box control does not have this limit.

      Replacing the control was relatively effortless. All I had to do was
      define it as MultiLine with vertical scrollbar and to set the
      RightMargin to the ScaleWidth on the Form_resize() procedure.

      Thanks for the reference.

      xyz.

      =========
      On Sat, 08 Nov 2003 00:15:00 GMT, "Randy Birch"
      <rgb_removethis @mvps.org> wrote:
      [color=blue]
      >While strings can be 2^32 characters, edit controls (text boxes) are limited
      >to 64k.
      >
      >http://msdn.microsoft.com/library/de...imitations.asp[/color]

      Comment

      Working...