display items from listbox to datagrid

jyu0101

Newcomer
Joined
Dec 13, 2002
Messages
2
Hi, I'm relatively new to programming.

After I load up my items in the listbox. I want to choose items and have them display in a datagrid.

For instance, If I have apples, oranges, bananas in the listbox. Say I select apples then oranges, I want them to display as a list in the datagrid. Later, I will assign values to them and add them up.

Like this:
apples
oranges

Also, how can I load up the items from another form. Say I have a textbox in anther form that can add onto the current list.

For instance. I have a textbox named txtAddItem in frmAddItem and when I type into it and hit update, it will be added to the other form's, named frmOther, listbox.

Thanks in advance
 
you can use this to get the value of each item selected...
Visual Basic:
             Dim nCounter As Integer

            For nCounter = List1.Items.Count To 1 Step -1
                If List1.GetSelected(nCounter - 1) = True Then
                    MessageBox.Show(List1.Items.Item(nCounter - 1))
                End If
            Next

And please DO NOT report a post unless you have a valid reason.
It is not to get our attention to merely answer your threads.
 
Back
Top