Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The problem is to transfer a selected item from Form2 listbox(lstPrint) to Form1 listbox (lstProducts). I understand everything that he is saying but everytime I

The problem is to transfer a selected item from Form2 listbox(lstPrint) to Form1 listbox (lstProducts). I understand everything that he is saying but everytime I assume that I make the corrections that he states, I get errors. I get the concept but I am very confused on how he wants it done. Also have tried multiple ways ive looked up but I can not get any to work so I am exhausted from options right now. Thank you for the help.

image text in transcribedimage text in transcribedimage text in transcribed

- Q8 listbox to listbox Changsub Shim, Colton Mueller Applications Development IstPrint.Items.Add(Storage.Selectedltems[0].ToString()); Here, your Form2's btnAdd procedure contains one statement that has full of errors. First, you want to send IstPrint's selectedltem to Form1's Storage, right? Then, you should use Storage's Add method, not IstPrint's Add method. What you are trying in your statement is Adding a Storage value to lstPrint ListBox in Form 2 . This is completely opposite way. Second, Storage is static which means it belongs to a Form1's class name. So, you should call it Form1.Storage Third, Selecteditems[0] is used only when you turn on multiple selection in the ListBox. If you cannot select multiple items at the same time, you should use only Selectedltem.ToString(), not Selectedltems (do not use 's' at the end) Changsub Shim, Colton Mueller February 24,2023 at 1:45pm Applications Development Probably, you did not read my previous comments. Any visual controls (including ListBox) can not be shown on other forms (controls are protected inside the form, they can not be public). That's why we use a List collection variable, to send from one ListBox to another form's ListBox. Form 2 Listbox ==> Form1 public static List>==> Form 1 ListBox. Colton Mueller, Changsub Shim February 24,2023 at 1:30pm Applications Development

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions