lundi 29 septembre 2014

C# Using Listbox to display only a select few characters of description


Vote count:

0




The code i currently have below populates a list box with the Id, description and company



DataTable dTable = new DataTable();
dataAdapter.Fill(dTable);

DataColumn dcDisplayMember = new DataColumn("DisplayMember");
dcDisplayMember.Expression = string.Format("{0}+'\t\t'+{1}+'\t\t'+{2}", "dId", "Description", "Company");


dTable.Columns.Add(dcDisplayMember);


BindingSource bSource = new BindingSource();
bSource.DataSource = dTable;
listBox.DataSource = bSource;
listBox.DisplayMember = "DisplayMember";


However what i am trying to achieve is getting the list box to display a shorter version of the description column e.g. description of something...


I know i have to do something to



string.Format("{0}+'\t\t'+{1}+'\t\t'+{2}", "dId", "Description", "Company")


But i am not sure as to what



asked 1 min ago







C# Using Listbox to display only a select few characters of description

Aucun commentaire:

Enregistrer un commentaire