Results 1 to 5 of 5

Thread: How to go about splitting an arraylist?

  1. #1

    Thread Starter
    New Member Milkmandan's Avatar
    Join Date
    Apr 2006
    Posts
    2

    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.
    There are 10 kinds of people in the world. Those who understand binary, and those who don't.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    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).
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  4. #4

    Thread Starter
    New Member Milkmandan's Avatar
    Join Date
    Apr 2006
    Posts
    2

    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.

    At any rate, I hope this helps. Sorry for the lack of clarity.
    There are 10 kinds of people in the world. Those who understand binary, and those who don't.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width