Link to home
Start Free TrialLog in
Avatar of KalluMama
KalluMama

asked on

Two forms and two listboxes

OK I have two forms and each with one list box. When the user click on open on the first form the second form opens up. When the user selects something from the second form's listbox and clicks on ADD that item gets added to the first forms listbox...how do i do this?

formCart.lstProducts.Items.Add(Me.lstPrintBooks.SelectedItem)

I tried this code...but it does not work...

Thanks
ASKER CERTIFIED SOLUTION
Avatar of smoee
smoee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KalluMama
KalluMama

ASKER

smoee...that is exactly what i was looking to do...how do i get more information on this!??! I looked in a few books but none explained this...
I don't have a specific information recomendation, but the essence of the solution is that you needed to refer to an instance of a class, not the class itself.  The issue was how to pass an instance of your first form to your second form.  Personally, I usually do this by creating a property on the second form to hold the instance of the first form, then when your first form opens your second form, first create a second instance of the second form, set its parent property to the first form ,then show the second form.  Now the second form has a reference to the first form.
ok i kinda sort got that...but no harm...i will keep "property" in mind and do some more research to get better understanding of this issue...thanks!!