Dynamically allocated memory

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

    Dynamically allocated memory

    How can I dynamically allocate memory in VB? I wish to do this....

    Dim szData as String * 250

    I can't allocate memory like this cause I am not sure how much to alloate.

    I want to do something like this..

    dim iLen as Integer
    dim szData as String

    iLen = CalcSize()
    Now allocate szData to the length of iLen....

    Please help

    Thanks
    Ralph Krausse

    Use the START button? Then you need CSFastRunII...
    A new kind of application launcher integrated in the taskbar!
    ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg
  • Raoul Watson

    #2
    Re: Dynamically allocated memory


    "Ralph Krausse" <gordingin@cons iliumsoft.com> wrote in message
    news:49eb6317.0 405131516.3a7dd 308@posting.goo gle.com...
    [color=blue]
    >
    > iLen = CalcSize()
    > Now allocate szData to the length of iLen....
    >[/color]
    REDIM szData(iLen)


    Comment

    • Randy Birch

      #3
      Re: Dynamically allocated memory

      Dim szData as String
      iLen = CalcSize()
      szData = space$(iLen)

      .... or, of for APIs, you can also use:

      szData= string(iLen, vbnullchar)

      --

      Randy Birch
      MVP Visual Basic

      Please respond only to the newsgroups so all can benefit.


      "Ralph Krausse" <gordingin@cons iliumsoft.com> wrote in message
      news:49eb6317.0 405131516.3a7dd 308@posting.goo gle.com...
      : How can I dynamically allocate memory in VB? I wish to do this....
      :
      : Dim szData as String * 250
      :
      : I can't allocate memory like this cause I am not sure how much to alloate.
      :
      : I want to do something like this..
      :
      : dim iLen as Integer
      : dim szData as String
      :
      : iLen = CalcSize()
      : Now allocate szData to the length of iLen....
      :
      : Please help
      :
      : Thanks
      : Ralph Krausse
      : www.consiliumsoft.com
      : Use the START button? Then you need CSFastRunII...
      : A new kind of application launcher integrated in the taskbar!
      : ScreenShot - http://www.consiliumsoft.com/ScreenShot.jpg

      Comment

      Working...