i know how to transfer or pass value from one Listbox to Another Listbox
but i Don't know how transfer it without selection
What I have tried:
listBox2.Items.Add[listBox1.SelectedItem];
listBox1.Items.Remove[listBox1.SelectedItem];
this i tired but i select the items but i want to without selecting, transfer them
All you have to do is decide which item[s] you want, and access them directly via the Items property:listBox2.Items.Add[listBox1.Items[indexOfItemIWant]]; listBox1.Items.Remove[listBox1.Items[indexOfItemIWant]];
It's basically the same, but you just define the index of the item you want to modify.
Consider the following example
[ADDED]
Example of moving several items
[ADDED]
Since you're using multiselect list as source, you can loop through the selected items. For example
Add your solution here
B I U S small BIG code var < > & link [^] encode untab case indent outdent
Preview 0
Existing Members | ...or Join usDownload, Vote, Comment, Publish. | ||
|
- Read the question carefully.
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
- If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
- Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
This content, along with any associated source code and files, is licensed under The Code Project Open License [CPOL]
CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 [416] 849-8900