c# - Populating multiple comboboxes in a single event -
i'm trying populate number of combo boxes in formload method, 1st 1 populates. in same method same stored procedures called data grids , work fine. please see attached code:
private void frmmain_load(object sender, eventargs e) { dataaccesslayer dal = new dataaccesslayer(); pnleditcall.visible = false; pnleditinspection.visible = false; pnleditequipment.visible = false; #region populate datagrids dgvinspections.datasource = dal.getallinspections(); dgvcalls.datasource = dal.getallcalls(); dgvstaff.datasource = dal.getallstaff(); dgvlabs.datasource = dal.getalllabs(); dgvequipment.datasource = dal.getallequipment(); #endregion #region populate comboboxes cmbinspectionstaff.datasource = dal.getallstaff(); cmbinspectionstaff.displaymember = "name"; cmbinspectionstaff.valuemember = "[staffid]"; cmbcallstaff.datasource = dal.getallstaff(); cmbcallstaff.displaymember = "name"; cmbcallstaff.valuemember = "[staffid]"; cmbcurrentlab.datasource = dal.getalllabs(); cmbcurrentlab.valuemember = "[labno]"; cmbcurrentlab.displaymember = "[labno]"; #endregion }
Comments
Post a Comment