Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How? Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Go Back  Xtreme Visual Basic Talk > > > Get data in to an array without defined elements. How?


Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2017, 10:35 AM
skyfox's Avatar
skyfox skyfox is offline
Centurion
 
Join Date: Feb 2005
Location: InsideACircularReference
Posts: 190
Default Get data in to an array without defined elements. How?


Hopefully the title wasn't too confusing as my terminology may be off. The following statement, takes contents of a textbox with comma seperated values and puts them in to a string array called my values.

textbox1. text contains.... "1,2,3,4,5,6" etc. (all numeric values)

Code:
 Dim MyValues As String() = textBox1.Text.Split(New Char() {","c})
What I want to do is, instead of comma seperated values from a text box, I want to get content of a string array (all elements) in to MYValues() from above.

So I have;
Code:
Dim MyStrings(25) as string
What is the proper syntax to get the values in "MyStrings(25)" put in to "MyValues()"?

I could loop thru "MyStrings" array and create a resulting string with comma separated values and then use the split function to load the data in to "Myvalues" like the example above. But that seems like several unnecessary steps. Just in case if anyone is wondering "Myvalues" is sent to a device via serial communications. So I am guessing it is a type of character array of some sort.

Thanks!
__________________
SkyFox
Tinker of All, Master of NONE!
"To B or Not To VB? That's the Question"

Last edited by skyfox; 09-01-2017 at 01:28 PM.
Reply With Quote
  #2  
Old 09-02-2017, 01:22 AM
Goggy's Avatar
Goggy Goggy is online now
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default Join

I hope I understood you rite, but if so. You could take a look at the join function.

It works like so:

Code:
     Dim MyStrings(25) As String

        For i As Integer = 65 To 90
            MyStrings(i - 65) = Chr(i)
        Next

        MsgBox(Join(MyStrings, ",")) ' <-----Joins the array
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote
  #3  
Old 09-02-2017, 01:44 AM
skyfox's Avatar
skyfox skyfox is offline
Centurion
 
Join Date: Feb 2005
Location: InsideACircularReference
Posts: 190
Default

Thanks Goggy,

Thanks for the reply. Not exactly what I was looking for. (Perhaps I may be confused on this)

Lets say.......

textbox has " 1, 2, 3"

MyArray of strings has...

MyArray(0) =1
MyArray(1) =2
MyArray(2)= 3


Dim MyValues As String() = textBox1.Text.Split(New Char() {","c})

This removes the comma and puts 1 and 2 and 3 in to MyValues array. Will the join function do the same? I want to get 1 and 2 and 3 from the array and put it in to MyValues string array exactly like the split function does with the textbox contents.

It is late and my head is spinning from this seemingly trivial task. (that and a half a bottle of Kentucky Bourbon. Nectar of the God's if you will)

On a side note, people that gave the world "Stroopwafel", can't possibly be all that useless.
__________________
SkyFox
Tinker of All, Master of NONE!
"To B or Not To VB? That's the Question"
Reply With Quote
  #4  
Old 09-02-2017, 01:47 AM
Goggy's Avatar
Goggy Goggy is online now
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Yes it will do the reverse. For the delimiter you could use any string value or a empty string if you like...



on a side note... how do you know about our stroopwafels? :P
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote
  #5  
Old 09-02-2017, 02:17 AM
skyfox's Avatar
skyfox skyfox is offline
Centurion
 
Join Date: Feb 2005
Location: InsideACircularReference
Posts: 190
Default

Thanks Goggy,

I will give it a go in the morning. About the stroopwafels.... Long story short, My girlfriend was adopted by Dutch Parents. Her dad comes from the family of famed dutch painter (at least according to her), Mezdag. In fact, I believe the 100th Anniversary celebration was last year in Belgium if I am not mistaken. We were invited to attend, but was not able to go. There is a huge Mezdag clan here in the Pacific Northwest in the US (Washington & Oregon) and in Alaska. In fact, they might even out number the Mezdag's in Holland now. She speaks fluent Dutch as well. She told me when they were growing up, they had to speak Dutch when they were upstairs and English when they were downstairs. I got to meet her dad before he passed away few years ago. He was an incredible and a kind gentleman. He had five kid of his own and adopted and cared for 5 more kids. He even had homeless people living on his property in tents until they could get back on their feet. So, that was my first experience with the Dutch (actually 2nd because I come from a country where it was a dutch Colony in the 1800's) and I say CHEERS TO ALL OF YOU! Love all those Sambol as well!!!!
__________________
SkyFox
Tinker of All, Master of NONE!
"To B or Not To VB? That's the Question"
Reply With Quote
  #6  
Old 09-02-2017, 02:22 AM
Goggy's Avatar
Goggy Goggy is online now
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

Wow,

Thats an impressive and wonderful story. :-) Good to hear the land of the stroopwafels is appreciated in other parts of the world as well.

I hope the code works for ya in the morning.
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote
  #7  
Old 09-07-2017, 01:46 PM
passel's Avatar
passelGet data in to an array without defined elements. How? passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,024
Default

p.s. My mistake. I thought this was a VB6 question for some reason.
Assuming my premise below is correct, to copy the one array to a dynamic array you can use the .Clone method in VB.Net.
MyValues = MyStrings.Clone

Quote:
Originally Posted by skyfox View Post
...
So I have;
Code:
Dim MyStrings(25) as string
What is the proper syntax to get the values in "MyStrings(25)" put in to "MyValues()"?
...
I don't see that he wants to join the elements of the one array into a single string. He has indicated twice that he wants to copy the elements of the MyStrings array into the MyValues array so that the arrays match.

I'm not sure why you wouldn't just do
MyValues = MyStrings

if you want to copy the strings in MyStrings array into the MyValues array, a one to one copy.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.

Last edited by passel; 09-07-2017 at 02:01 PM.
Reply With Quote
Reply

Tags
string, values, myvalues, array, comma, mystrings25, dim, seperated, elements, text, defined, box, content, data, proper, syntax, have;, char, textbox1.text.splitnew, terminology, textbox, contents, takes, statement, confusing


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How? Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How? Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
 
Get data in to an array without defined elements. How?
Get data in to an array without defined elements. How?
 
-->