chkListBuilding.Items.Clear();
DataTable dtBuilding = (new BuildingManager()).SelectBuilding();
((ListBox)chkListBuilding).DataSource = dtBuilding;
((ListBox)chkListBuilding).DisplayMember = "BuildingName";
((ListBox)chkListBuilding).ValueMember = "BuildingID";
DataTable dtBuilding = (new BuildingManager()).SelectBuilding();
((ListBox)chkListBuilding).DataSource = dtBuilding;
((ListBox)chkListBuilding).DisplayMember = "BuildingName";
((ListBox)chkListBuilding).ValueMember = "BuildingID";
2 comments:
For Someone else this:
((ListBox)chkListBuilding).DataSource = dtBuilding;
((ListBox)chkListBuilding).DisplayMember = "BuildingName";
((ListBox)chkListBuilding).ValueMember = "BuildingID";
is not necessary you can use:
chkListBuilding.DataSource = dtBuilding;
chkListBuilding.DisplayMember = "BuildingName";
chkListBuilding.ValueMember = "BuildingID";
You don't need a cast.
Post a Comment