Display member in listbox using mysqldatatable as datasource

Display member in listbox using mysqldatatable as datasource

Postby oleengvoll » Tue 15 May 2012 11:34

Hi! We are using a listbox with a mySqlDataTable as datasource. How can we make custom columns displaying several data field (combined) to be shown in "DisplayMember" in the listbox? Now we can only choose one field that exists in the mySqlDataTable columns. Thanx. Ole
oleengvoll
 
Posts: 12
Joined: Tue 27 Sep 2011 08:37

Re: Display member in listbox using mysqldatatable as dataso

Postby Pinturiccio » Thu 17 May 2012 13:43

According to MSDN http://msdn.microsoft.com/en-us/library/system.windows.forms.listcontrol.displaymember.aspx The ListBox DisplayMember property can set a String specifying the name of an object property that is contained in the collection specified by the DataSource property. So you can assign one of the columns as a DisplayMember property value, but you cannot assign a combination of columns, as the MySqlDataTable object has no property corresponding to the combination.
If you want to display several columns, try using the DataGridView component instead of ListBox.
Pinturiccio
Devart Team
 
Posts: 2045
Joined: Wed 02 Nov 2011 09:44

Re: Display member in listbox using mysqldatatable as dataso

Postby oleengvoll » Fri 18 May 2012 11:26

Hi! OK, thanx. I'll try this solution! /Ole
oleengvoll
 
Posts: 12
Joined: Tue 27 Sep 2011 08:37


Return to dotConnect for MySQL