|
-
Dec 8th, 2004, 10:44 AM
#1
Thread Starter
New Member
How to add array items to a string
Hi,
I have a array named item(3) which contains 4 strings.
i.e.
item(0) = hallo
item(1) = how
item(2) = are
item(3) = you?
Now, i would like these 4 elements in one string named AllTekst.
I decladed AllTekst as a string, but vb says it cannot cast an 1 dimensional array to type string.
Can somebody help me?
Thanks in advance.
Niels
-
Dec 8th, 2004, 10:50 AM
#2
PowerPoster
Re: How to add array items to a string
Hi,
Must be somethin peculiar in your code. Please post it.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Dec 8th, 2004, 10:57 AM
#3
Re: How to add array items to a string
Hi
have you tried something like this?
Code:
AllTekst = item(0) & item(1) & item(2) & item(3)
Regards
Jorge
"The dark side clouds everything. Impossible to see the future is."
-
Dec 8th, 2004, 11:00 AM
#4
Re: How to add array items to a string
no that makes sense... you can't assign an array to a string, because it doesnt know what you REALLY want to do is put all values of the elements of the array into the string.. all VB sees is you trying to say
string = array
Code:
Dim MyString As String
For i As Integer = 0 To item.GetUpperBound(0)
MyString &= item(i)
Next
if you are putting a sentence together.. you may want to add spaces in between words..
MyString &= item(i) & " "
-
Dec 8th, 2004, 11:36 AM
#5
Thread Starter
New Member
Re: How to add array items to a string
Thank you!, this is what i needed!!
Last edited by unxpected; Dec 8th, 2004 at 11:43 AM.
-
Dec 8th, 2004, 02:07 PM
#6
Re: How to add array items to a string
It may be intentional, but the first word is generally spelled hello rather than hallo.
My usual boring signature: Nothing
 
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
|