private void frmCritialDeptList_Load(object sender, EventArgs e) { this.dgvDeptList.SelectionMode = DataGridViewSelectionMode.FullRowSelect; try { clsHISReportZy_Supported_Svc svc = (clsHISReportZy_Supported_Svc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(clsHISReportZy_Supported_Svc)); DataTable dt = svc.GetDeptList(deptint); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { int index = this.dgvDeptList.Rows.Add(); //this.dataGridView1.Rows[index].Cells[0].Value = index.ToString(); this.dgvDeptList.Rows[index].Cells[1].Value = (index + 1).ToString(); this.dgvDeptList.Rows[index].Cells[2].Value = dr["code_vchr"].ToString().Trim(); this.dgvDeptList.Rows[index].Cells[3].Value = dr["deptname_vchr"].ToString().Trim(); } } } finally { } }