[VB.Net] Stuck with String Array |
|
06-18-2012, 03:00 PM
(This post was last modified: 06-18-2012 03:02 PM by Fragma.)
|
|||
|
|||
|
Stuck with String Array
This has been rattling my brain for the past hour or so now so I thought I'd post here for some help.
Basically, I want it so that whenever a user hits the "add" button, the string they entered is added to an array. I want to be able to then loop through each of the strings in the array in a separate sub. Here's what I have so far: Public variable for array: Code: (SELECT ALL CODE) Dim IDS() As StringAdd button: Code: (SELECT ALL CODE) othID = webClient.DownloadString("http://www.youtube-mp3.org/api/itemInfo/?video_id=" + getID()) Download button: Code: (SELECT ALL CODE) For Each value As String In IDS I know that I can add a number to the array like so: "Dim IDS(20) As String", however the problem is, there isn't a set number of strings for the array to hold, I just want it to hold however many items are in the urlList when the user clicks download. I can't figure out how to do this since the array is a public variable. Hopefully this all made sense. Any help would be greatly appreciated, thanks. |
|||
|
06-18-2012, 03:31 PM
|
|||
|
|||
|
RE: Stuck with String Array
I don't completely understand what you are trying to do still, but could using ReDim help?
http://msdn.microsoft.com/en-us/library/...s.80).aspx |
|||
|
06-18-2012, 03:41 PM
|
|||
|
|||
|
RE: Stuck with String Array
ReDim would work, but for something like this.. I think using a list would be a better option. Review this sample code to give you an idea. If you would like a better explanation, just let me know.
Code: (SELECT ALL CODE) Dim lstIDs As New List(Of String) |
|||
|
06-18-2012, 03:49 PM
|
|||
|
|||
RE: Stuck with String Array
(06-18-2012 03:41 PM)KoBE Wrote: ReDim would work, but for something like this.. I think using a list would be a better option. Review this sample code to give you an idea. If you would like a better explanation, just let me know.You're a legend thank you so much. I didn't even know you could do that. |
|||
|
06-18-2012, 07:47 PM
|
|||
|
|||
|
RE: Stuck with String Array
ReDim is slow though, as KoBE shown you why wouldn't you just use a List(of String)?
![]() Microsoft MVP .NET Programming - (2012 - Present) ®Crestron DMC-T Certified Automation Programmer Development Site: aceinfinity.net |
|||
|
06-19-2012, 08:50 AM
|
|||
|
|||
| RE: Stuck with String Array | |||
|
06-19-2012, 07:48 PM
|
|||
|
|||
|
RE: Stuck with String Array
I read all your posts, just saying, or you didn't know about List(of String) at the time? Or perhaps Redim?
![]() Microsoft MVP .NET Programming - (2012 - Present) ®Crestron DMC-T Certified Automation Programmer Development Site: aceinfinity.net |
|||
|
06-20-2012, 07:55 AM
|
|||
|
|||
|
RE: Stuck with String Array
Yeh I didn't know of either of those methods when posting the thread. I've always just used what I was before hand. :P
I'll probably be a little more active here now since I'm trying to get back into coding. |
|||
|
06-20-2012, 08:55 AM
(This post was last modified: 06-20-2012 08:56 AM by KoBE.)
|
|||
|
|||
RE: Stuck with String Array
(06-20-2012 07:55 AM)Fragma Wrote: Yeh I didn't know of either of those methods when posting the thread. I've always just used what I was before hand. :P Edit: Wow, I decided to go see how SF's coding section was doing... :\ Yikes. |
|||
|
06-20-2012, 09:02 AM
|
|||
|
|||
RE: Stuck with String Array
(06-20-2012 08:55 AM)KoBE Wrote:I didn't have time for it. I don't take it seriously enough to do all of the time, it's just a hobby.(06-20-2012 07:55 AM)Fragma Wrote: Yeh I didn't know of either of those methods when posting the thread. I've always just used what I was before hand. :P Most of my time is spent making animations, illustrations and web graphics. But it does feel good to get back into the swing of things, even if I rarely ever finish a program lol. And yeh, SF is near dead now. I haven't posted on there since the thread I made about Breshie's ban. Omni doesn't give a damn about that place so why should the members??
|
|||
Possibly Related Threads... |
| Thread: | Author | Replies: | Views: | Last Post | |
String Format ! |
Omegastarscream15 | 5 | 167 |
04-05-2013 04:52 PM Last Post: AceInfinity |
|
IF statement vs array ? |
william7 | 7 | 279 |
03-17-2013 01:54 AM Last Post: AceInfinity |
|
How do you convert date to string and format it for short version "d"? |
william7 | 14 | 383 |
03-05-2013 12:15 AM Last Post: AceInfinity |
|
MY String Encoding Example |
AceInfinity | 1 | 171 |
01-18-2013 12:23 PM Last Post: AceInfinity |
|
[Tutorial] Draw a Rotating String [GDI] |
ThePrinCe | 3 | 298 |
12-03-2012 04:16 PM Last Post: Epixors |
|
| Users browsing this thread |
| 1 Guest(s) |

Stuck with String Array





