Hello,
My vb.Net code interacts with a design software and extracts a list of strings into an array.
I want to use that array to populate a list box on a form. Every search I try always retursn "How to send array from one form to another" I only have the one form. I know this is a newbie question, but I can't get it to populate. Can anyone help me?
Do I put everything in the form_load, or define the variables in the module? I cant seem to pass the variable from the module to the form listbox.
Thanks,
Mark

Recommended Answers

All 2 Replies

Loop through your array and for each item and call
ListBox.Items.Add()

You can call that in your Load event as you want the list populated when the form appears.

Alternatively you could assign the array as the DataSource for the ListBox:

    Dim strings() As String = {"B", "C"}
    ListBox1.DataSource = strings
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.