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 problem trying to fill LISTBOX with DATASET and CATCH to display error message.
In the LISTBOX dropdown list instead of displaying CUSTOMERNAME, it display System.Data.DataViewManagerListItemTypeDescriptor
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)
{
}
}
Thank you .