Listbox

  • 19 years ago

    I have two listbox's in a program I am writing, the users can add or remove from this listbox, but once they have finished they press a confirm button and I need to use all the contents of these listboxs.


    Example ListBox1          Example ListBox2
    PC1                             File 1
    PC2                             File 2
    PC3                            


    How can I either put all the contents of the listbox into an array, or how can I find out what is in field 2 of the listbox1?


    Hope I have made this clear?

  • 19 years ago

    To put everything in an array...

    Code:

    Redim TheArray(0 To ListBox1.ItemCount-1)
    For i = 0 to ListBox1.Count-1
       TheArray(i)=ListBox1.List(i)
    Next


    I'm not sure what you mean by field2 of listbox 1... but to get the value of item 2 in listbox 1, try
    ListBox1.List(1)

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Java is to JavaScript what Car is to Carpet.” - Chris Heilmann