Page 1 of 1

Display member in listbox using mysqldatatable as datasource

Posted: Tue 15 May 2012 11:34
by oleengvoll
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

Re: Display member in listbox using mysqldatatable as dataso

Posted: Thu 17 May 2012 13:43
by Pinturiccio
According to MSDN http://msdn.microsoft.com/en-us/library ... ember.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.

Re: Display member in listbox using mysqldatatable as dataso

Posted: Fri 18 May 2012 11:26
by oleengvoll
Hi! OK, thanx. I'll try this solution! /Ole