Hi Good Guys,
I am learning how to use C#Net2008 to develop Window Application. I was a
VB.NET2008 developer. I need your help, Please Help me.
I am encountering 2 problems trying to fill LISTBOX with DATASET and CATCH to display error message.
In the LISTBOX dropdown list instead of displaying CUSTOMERNAME, it displays System.Data.DataViewManagerListItemTypeDescriptor
Here are the Coding to fill LISTBOX with DATASET
Code:
private void FLoadListBox()
{
string strSql = "Select CustomerID, CompanyName from Customers order by CompanyName";
sqlconn = new SqlConnection(connstr);
sqlconn.Open();
sqlDA = new SqlDataAdapter(strSql, sqlconn);
DS = new DataSet("DS");
try
{
DS.Clear();
DS.CaseSensitive = true;
sqlDA.Fill(DS,"Cust");
// fill listbox
this.listBoxCust.DisplayMember = "CompanyName";
this.listBoxCust.ValueMember = "CustomerID";
this.listBoxCust.DataSource = DS;
sqlconn.Close();
}
catch (SystemException MsgException)
{
}
}