473,466 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Changing the length of a string at runtime

13 New Member
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 1139
Dököll
2,364 Recognized Expert Top Contributor
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 Recognized Expert Expert
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 New Member
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 Recognized Expert Expert
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

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

Similar topics

2
by: Jody Burgess | last post by:
Hi; I am writing my first python program and would like to know how to change stdout to refer to my default printer or any other printer on my network. The other question is, Is there an API set...
1
by: Sean | last post by:
i am writing a class that visual demonstrates the result of changing the quality of a jpeg. the intention is to do this by saving the file and a selected quality, then reloading it to get an idea of...
7
by: Robert Mark Bram | last post by:
Hi All! How do you get the length of an associative array? var my_cars= new Array() my_cars="Mustang"; my_cars="Station Wagon"; my_cars="SUV"; alert(my_cars.length);
7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
1
by: active | last post by:
Private Structure TNavRec <VBFixedString(100),System.Runtime.InteropServices.MarshalAs(System.Runtime. InteropServices.UnmanagedType.ByValTStr,SizeConst:=100)> Public strItemName As String ...
2
by: Tom | last post by:
I'm getting this error when I try to pass a structure to a dll. An unhandled exception of type 'System.ArgumentException' occured in Test1.exe Additional Information: Type could not be marshaled...
4
by: Trapulo | last post by:
I've a webservice with a string parameter. I call this webservice passing a string that is 1129 chars length. On the webservice, the received string is 1146 length (I tested sizes with...
1
by: Rick Knospler | last post by:
I am trying to convert a vb6 project to vb.net. The conversion worked for the most part except for the fixed length strings and fixed length string arrays. Bascially the vb6 programmer stored all...
8
by: =?Utf-8?B?U3RldmUgQmVobWFu?= | last post by:
In Visual C++ 8.0 Express I am trying to programmatically change the contents of a text box. In form1.h I find the initializing code _PAYEE->Text=L"a";. I assumed that the type of "a" in this...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.