G
Guest
Hey All,
I am having a little trouble with the ListBox's Items collection property. I
am populating the ListBox with data contained in an SQL table using
SQLDataAdapter and DataSet.
I have set the "DataSource", "DisplayMember", and "ValueMember" properties
of the ListBox correctly like below:
lbTechnician.DataSource = TechnicianDataSet.Tables[0];
bTechnician.DisplayMember = "Name";
lbTechnician.ValueMember = "Name";
Where "lbTechnician" is the name of the ListBox and "Name" is one of the
columns of the SQL table.
The application is compiling with 0 errors and 0 warning. But when I try to
run it JIT (Just-In-Time) Debugging is giving me following error:
"Can't modify the Items collection when the DataSource property is set"
I checked the Items collection for the ListBox. Its empty. I dont have any
idea how to fix this error.
Can anybody help me out.
Thanks in advance,
Prasad
I am having a little trouble with the ListBox's Items collection property. I
am populating the ListBox with data contained in an SQL table using
SQLDataAdapter and DataSet.
I have set the "DataSource", "DisplayMember", and "ValueMember" properties
of the ListBox correctly like below:
lbTechnician.DataSource = TechnicianDataSet.Tables[0];
bTechnician.DisplayMember = "Name";
lbTechnician.ValueMember = "Name";
Where "lbTechnician" is the name of the ListBox and "Name" is one of the
columns of the SQL table.
The application is compiling with 0 errors and 0 warning. But when I try to
run it JIT (Just-In-Time) Debugging is giving me following error:
"Can't modify the Items collection when the DataSource property is set"
I checked the Items collection for the ListBox. Its empty. I dont have any
idea how to fix this error.
Can anybody help me out.
Thanks in advance,
Prasad