In this post we will see a simple example with listbox . Here we will see how to add values to listbox at runtime . And Multi Select Property of ListBox. And how to copy selected values of listbox to textbox.
For this I am designing a form with a ListBox and 3 Textboxes as shown in image below.
listbox-to-textbox-winforms
Now the C# code is like this:

 

I have written the code such that, the first selected item in a listbox will be copied to txtbox1 , second selected item will be copied to txtbox2 , third selected item will be copied to txtbox3.

See the image below

listbox-to-textbox-winforms_2

Leave a Reply

Your email address will not be published. Required fields are marked *