Question:
In Visual Basic 08 how do you use a button to add checkbox items to a list box.?
Jack
2009-05-09 04:12:47 UTC
Here's what I have:
- I've got 3 radio buttons which correspond to 3 list boxes (when a radio buttons is enabled or clicked the corresponding listbox's background changes colour to show it is selected)

- I've also got 20 checkboxes in a group box, each check box represents an item I want to add to a list.

- And I also have a button called "Add to selected list"

Here's what I want to be able to do:
- I want to be able to select whatever amout of items (checkboxes) I want, and add those items (whatever it say next to the checkbox) to the selected list box, when I click the "Add to selected list" button.

Yes it sounds like alot, but I'm really bad at programming and I need the help.

Thanks in advance.
Three answers:
anonymous
2009-05-09 04:20:21 UTC
Mail me on rsharmanzl@aol.in. I will send u the solution program for your problem.

Best of Luck
Sickness22
2009-05-09 04:27:29 UTC
Well its not that hard really, just a good bit of code. Lets say you've named your radio buttons A thru Z. Each represents an action you want listed in a text box. You would code something like this using VB8 code.



If RadioButtA.checked = TRUE then

TextList.Text = TestList.Text + 'Order Bulbs'



If RadioButtB.checked = TRUE then

TextList.Text = TestList.Text + 'Order Nails'



and so on until the status of all of the radio buttons have been checked by the program and the text property of the textlist object modified to show the items. It depends on how VB8 works and what properties are available for each object. You might find that the object TextList has a list property in place of a text property so your code would simply be:



If RadioButtA.checked = TRUE then

TextList.List = TestList.List + 'Order Bulbs'



If RadioButtB.checked = TRUE then

TextList.List = TestList.List + 'Order Nails'



But the idea is that each radio button object must be checked and some property of the listing object modified to show whats checked. The result should be when you've clicked all of the radio buttons you need checked and click your move to list button, the list will populate and look like this:



Order Bulbs

Order Nails





All of this code goes into the Click event of the button to move checked items info to the text list.



Good luck!!
faulkenberry
2016-10-20 08:11:52 UTC
do no longer try this: ListBox1.products.do away with( ListBox1.SelectedItem ) in view that is removing the article based on the fee and not the placement. So if there are duplicates, it is going to do away with all of them. try this: ListBox1.products.RemoveAt(ListBox1.Selec... this might purely do away with the only you have chosen.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...