Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > fill data in combobox
 

fill data in combobox

Hi all,


I am doing the combobox control. But the problem is that i do not know how to fill the combobox the data which i get from the sql server database into the combobox. Hope that anyone can help me. Is there any reference for me to look at??

Regards
LiL_Is
LiL_Is  Tuesday, July 21, 2009 4:06 AM
hi lil,
If you have datatable or collection ,set this to datasource property of combobox.
refer following link ,
http://msdn.microsoft.com/en-us/library/x8160f6f.aspx
and
http://msdn.microsoft.com/en-us/library/w67sdsex.aspx


set the ComboBox.DisplayMember to the property name you want to use for the display text. You can also set the ValueMember to a property on the contained objects that represents the object unique key.
  • Marked As Answer byLiL_Is Tuesday, July 21, 2009 7:03 AM
  • Unmarked As Answer byLiL_Is Tuesday, July 21, 2009 7:08 AM
  • Marked As Answer byLiL_Is Tuesday, July 21, 2009 9:17 AM
  •  
NareshG  Tuesday, July 21, 2009 5:05 AM
hi lil,
If you have datatable or collection ,set this to datasource property of combobox.
refer following link ,
http://msdn.microsoft.com/en-us/library/x8160f6f.aspx
and
http://msdn.microsoft.com/en-us/library/w67sdsex.aspx


set the ComboBox.DisplayMember to the property name you want to use for the display text. You can also set the ValueMember to a property on the contained objects that represents the object unique key.
  • Marked As Answer byLiL_Is Tuesday, July 21, 2009 7:03 AM
  • Unmarked As Answer byLiL_Is Tuesday, July 21, 2009 7:08 AM
  • Marked As Answer byLiL_Is Tuesday, July 21, 2009 9:17 AM
  •  
NareshG  Tuesday, July 21, 2009 5:05 AM

You can use google to search for other answers

Custom Search

More Threads

• Different items displayed in combo box column
• Databound Combobox Issue
• ArgumentOutOfRangeException when Filling DataTable databound to combobox or listbox
• Deleting a record
• How to set the TAB Control visible
• Enabling or Disabling DataGridViewCell
• Turn OFF Highlighted row in DataGridView
• Adding code to a visual basic 2005 button to run a sql query
• Focus the current row on datagridview
• row filter in data grid view