2

I'm extremely unfamiliar with ancient VB, and I'm trying to figure out the proper commands to concatenate an array (I am assuming it is in array form) into a string with comma separated values.

The values are being provided by a multiselect box, which is being assigned to the areas variable, which is grabbed from the areas select box.

dim name
dim from
dim company
dim phone
dim zip
dim message
dim areas

name = Request.Form("name")
from = Request.Form("from")
company = Request.Form("company")
phone = Request.Form("phone")
zip = Request.Form("zip")
areas = Request.Form("areas")
message = Request.Form("message")

I want to take areas, and implode it into a string.

What's the command in very old VB to do this?

8
  • VB.NET or VB6? VB.NET is rather new actually. Also, what do you want exactly? Please specify expected result. Commented Dec 20, 2013 at 16:30
  • VB6 I believe. I want to take an array, such as ["item", "item2", "item3", "item4"] and join them into a single string, such as "item, item2, item3, item4" Commented Dec 20, 2013 at 16:32
  • I am trying to read the Microsoft example on this - I think this is it, but I'm not quite sure of syntax: msdn.microsoft.com/en-us/library/… Commented Dec 20, 2013 at 16:32
  • 1
    You need to know for sure, because there will be different solutions. In VB.NET it's String.Join. Commented Dec 20, 2013 at 16:33
  • 1
    This, to me, looks like ASP classic which actually uses vbscript for the coding language. Basically, if you open a browser and type a url with a .asp extension, then my assumption is correct. If my assumption is correct, then areas may already be a comma separated string. Commented Dec 20, 2013 at 17:47

3 Answers 3

3

The Join function does also exist in VB6, the syntax is like this:

myString = Join(myArray, ",")

EDIT: Note that the array goes before the delimiter. The delimiter is optional, it'll be a space if left empty.

Sign up to request clarification or add additional context in comments.

1 Comment

I didn't ask how to concatenate. I asked how to implode/join an array of string values into a single string.
0

you want to use the Join function String.Join(",",array)

Comments

0

If you are using VB6, try this:

Join(New String() {name, from, company}, ", ")

EDIT: I know it's a link to VB.NET, but it's the old VB6 function call, it should be compatible with VB6, syntax wise.

1 Comment

@jac: Thanks for a link. I think the signatures are identical.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.