469,159 Members | 1,518 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Changing the length of a string at runtime

13
Hey I'm a Newb and i do software at school, im currently working on a vb 6.0 remote connection program. I need to change the length of a string at runtime, i'v already looked at redim for arrays, or using another string but i cant dimesion it with a variable.

Example i need to do this
Expand|Select|Wrap|Line Numbers
  1. dim a as string * variable
  2.  
or to some how redim.

any help with this or an alternate method would be much appreciated thanks.
Jun 26 '07 #1
4 941
Dököll
2,364 Expert 2GB
Hey I'm a Newb and i do software at school, im currently working on a vb 6.0 remote connection program. I need to change the length of a string at runtime, i'v already looked at redim for arrays, or using another string but i cant dimesion it with a variable.

Example i need to do this
Expand|Select|Wrap|Line Numbers
  1. dim a as string * variable
  2.  
or to some how redim.

any help with this or an alternate method would be much appreciated thanks.
Hello, chezz!

If you have not already searched here, I would suggest you do. Answers to this have been already added.

Please give that a whirl or stay tuned.

In a bit!
Jun 27 '07 #2
Killer42
8,435 Expert 8TB
I think it's fair to say that if you define a fixed-length string in VB, the length is fixed - hence the name. Hint: this is not the only type of string.
Jun 27 '07 #3
chezz
13
Hey i know that you can leave string undemensioned but im using a specific algorithm (mid$ function) to strip excess spaces out of a string. But don't worry i figured out a way around it. Thx anyway
Jun 27 '07 #4
Killer42
8,435 Expert 8TB
Oh well, glad you got it working, anyway.

One thing to keep in mind. I'm pretty sure Mid$() function doesn't mind if you go beyond the end of a variable-length string - it just doesn't return anything. So you don't need to worry about crashing because you overran the end, or anything.

In any case, I'm guessing the Len() function is probably your saviour.
Jun 28 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Robert Mark Bram | last post: by
7 posts views Thread by Stefan Finzel | last post: by
4 posts views Thread by Trapulo | last post: by
8 posts views Thread by =?Utf-8?B?U3RldmUgQmVobWFu?= | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.