Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Bind values to a ListView
 

Bind values to a ListView

Hello all,

I have several textboxes for First name, Last name, employee number and a listview on a form; depending on the values in the textboxes, how do idynamically bind the values in the textboxes to be displayedin the ListView in c#?

Thanks

omogen  Friday, September 11, 2009 7:46 AM
Hi omogen,

If we want to "synchronize" the data among the TextBoxes and the ListView, we can create a BindingSource and set its DataSource property to the data source. Then we can bind all the TextBoxes and the ListViewthis to this BindingSource.

This article is about "How to: Share Bound Data Across Forms Using the BindingSource Component" which can also be used among controls:
http://msdn.microsoft.com/en-us/library/ms404320.aspx.
You can get more information about BindingSource:
http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx.

Regards,
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Tuesday, September 15, 2009 7:52 AM
What is your data source? Also, I did not understand fully. Are you saying that you have a ListView where each item would represent a "record" of your data, and therefore you want to "synchronize" the selection of the item in the ListView with the contents of each textbox?
MCP
webJose  Friday, September 11, 2009 1:18 PM
Hi omogen,

If we want to "synchronize" the data among the TextBoxes and the ListView, we can create a BindingSource and set its DataSource property to the data source. Then we can bind all the TextBoxes and the ListViewthis to this BindingSource.

This article is about "How to: Share Bound Data Across Forms Using the BindingSource Component" which can also be used among controls:
http://msdn.microsoft.com/en-us/library/ms404320.aspx.
You can get more information about BindingSource:
http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx.

Regards,
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Tuesday, September 15, 2009 7:52 AM

You can use google to search for other answers

Custom Search

More Threads

• Buttons in form's titlebar
• Using Multiple Controls in a Form
• Global Assembly Cache (GAC)
• Showing property values as dropdownlist
• How can I get my Windows Forms Designer (in vb2005/.net Framework 2) started?
• How to customize scrollbar in Combobox-control
• Adding a combobox to the statusbar ...
• Composite Control Child Docking
• Custom collection inside inherited control NOT removed when control removed
• Email validation control or code for VB.Net 2005.