473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1137
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

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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.