468,306 Members | 1,229 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

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
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
Jul 17 '05 #1
2 2510

"Ralph Krausse" <go*******@consiliumsoft.com> wrote in message
news:49**************************@posting.google.c om...

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

REDIM szData(iLen)
Jul 17 '05 #2
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
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Ralph Krausse" <go*******@consiliumsoft.com> wrote in message
news:49**************************@posting.google.c om...
: 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

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Peter Olcott | last post: by
3 posts views Thread by Tony Johansson | last post: by
6 posts views Thread by bwaichu | last post: by
3 posts views Thread by Jinkuzo | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.