|
-
Feb 7th, 2007, 05:32 AM
#1
Thread Starter
Lively Member
string indexing replacement function for VB 6
Hi,
Does anyone know how to create a string and place two strings into it so they are formatted correctly. Trying to create a drop-down menu in VB6 and this is the only aspect I have difficulty with:
Have something like this using the replace function:
totalProjectDescription = "/// \\\"
changeProjectDescription = Replace(totalProjectDescription, "///", projectIVMNumber, 1, 1, vbTextCompare)
changeProjectDescription = Replace(changeProjectDescription, "\\\", projectDescription, 1, 1, vbTextCompare)
Unfortunately getting a result like this in my drop-down with incorrect spacing and unfortunately having difficulty showing this in my question (spacing removed)
I306 Millenium (spacing okay)
I307 Happy (2 characters onwards)
I324 Unhappy (4 characters onwards)
Anyone know how I can get it like:
I306 Millenium (correct spacing)
I307 Happy (correct spacing)
I324 Unhappy (correct spacing)
Is there an index replacement function in VB6?
Thanks.
-
Feb 7th, 2007, 06:19 AM
#2
Re: string indexing replacement function for VB 6
Try using just this line (don't use Replace)
VB Code:
changeProjectDescription = Trim$(projectIVMNumber) & " " & Trim$(projectDescription)
-
Feb 7th, 2007, 06:23 AM
#3
Re: string indexing replacement function for VB 6
don't know why you are doing it that way, how about
VB Code:
changeProjectDescription = Replace(totalProjectDescription, "/// \\\", projectIVMNumber & " " & projectDescription, 1, 1, vbTextCompare)
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|