How to go about splitting an arraylist?
I'll preface this by saying I'm very new to VB.Net. This is in reference to a project I'm working on for my college class, so I apologize in advance if my question may be stupid and/or unclear.
At any rate, the project I'm working on consists of a listbox that calls to one of two different forms for data. I need to be able to edit each entry by double clicking on that item in the listbox. Before I populate the popup, I need to know which form was originally used. (I hope that made sense)
I remember my professor saying we need to use something like ss = s.split(","c), so I can then use an If/then statement along the lines of:
If ss(3) = "Bliggidy" or "Blah" Then
Yadda yadda
End if
Unfortunately, I can't quite figure out how to get it to work. Can anybody provide some guidance on this?
Thank you in advance for any help you can provide.
Note: I am using Visual Studio .NET 2003/.NET Framework 1.1.
Re: How to go about splitting an arraylist?
I'm afraid that that is a little unclear, at least to me. Split is used to split a string into an array of substrings, where the point(s) to split at are a specific character, characters or substring. The rest I'm not exactly sure what you want. If you want to remember which form the values in a Listbox came form then it's up to you to store that information in some variable(s) for later use.
Re: How to go about splitting an arraylist?
If you want an array of values from the listbox you can just use ListBox1.Items.Item(i).
Re: How to go about splitting an arraylist?
Basically, the two sub forms have four fields of info that are being sent to the listbox on the main form. Here's an example of what 2 lines of my listbox contain after having one of each form used:
04/08/2006 04/09/2006 BookTitle Hard Cover
04/08/2006 04/09/2006 AudioTitle Cassette
When I double click on one of these lines, I need the popup to re-populate with the original information so I can edit each entry. Upon double clicking, I basically need to figure out if that line contains "Hard Cover" or "Cassette" at the end so I know which popup form to instantiate.
If I'm going about this completely wrong, let me know. :D
At any rate, I hope this helps. Sorry for the lack of clarity.
Re: How to go about splitting an arraylist?
Given that you have multiple data items in each row I'd use a ListView instead of a ListBox. The ListView allows you add multiple columns so you can keep each data item in a row distinct from the others. Then you can just check the Text property of the appropriate subitem in a row to see what it contains. Alternatively you could use a DataGrid or DataGridView and provide in-place editing.