Click here to Skip to main content
15,904,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i have two listbox which i want transfering listbox1 items to listbox2 with some filtering.

i look for a code which transfer items of listbox which start with "123" to another listbox.

ex: listbox1 items = { 564dfgg , 123rtete , 967asdasd}

after set "start with 123" filter:

listbox2 items = { 123rtete }



Also i ask in MSN Forums some hours ago but i receive no good answer.

Regard

-Amir Mohammad Nasrollahi
Posted

 
Share this answer
 
Comments
[no name] 1-Aug-13 6:23am    
Oh thanks for Solution and Upload! but this code is Visual Basic. what about C#?
pjaar89 1-Aug-13 8:08am    
https://www.dropbox.com/s/en5kp9igesoqp3w/WindowsFormsApplication1.rar
mohammad riahi 6-Aug-13 9:00am    
hi my friend
i'm working system programming
Do you have experience in this topic?
:-)

VB
Dim filteredItems = From item In ListBox1.Items Select item Where item.ToString.StartsWith("123")
ListBox2.Items.AddRange(filteredItems.ToArray)
 
Share this answer
 
Comments
[no name] 1-Aug-13 6:05am    
is it VB??
pjaar89 1-Aug-13 6:09am    
Yup

From item In ListBox1.Items Select item Where item.ToString.StartsWith("123")

this is a LINQ query
[no name] 1-Aug-13 6:11am    
why code dose not work? :(

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