private void dgvProcessing_SelectionChanged(object sender, EventArgs e) { if (dgvCompleted.SelectedRows.Count > 0) { dgvCompleted.ClearSelection(); } try { string category = dgvProcessing.SelectedRows[0].Cells[0].Value.ToString(); Debug.WriteLine(category); if (category == "IT技術支援") { DataFormSupport form = new DataFormSupport("processing"); form.ChangedEvent += new EventHandler(form_ChangedEvent); LoadControl(form); } else if (category == "資產外借") { DataFormAsset form = new DataFormAsset("processing"); form.ReloadEvent += new EventHandler(form_ReloadEvent); LoadControl(form); } else if (category == "權限及軟件安裝") { DataFormPermission form = new DataFormPermission("processing"); LoadControl(form); } else if (category == "工具開發/修改") { Debug.WriteLine("aaa"); DataFormDevelop form = new DataFormDevelop("processing"); LoadControl(form); } else if (category == "IT意見箱") { DataFormComment form = new DataFormComment("processing"); LoadControl(form); } else if (category == "R3申請") { DataFormR3 form = new DataFormR3("processing"); LoadControl(form); } else { return; } } catch (Exception ex) { Debug.WriteLine(ex.Message + ex.StackTrace); //dgvProcessing.ClearSelection(); } }
private void dgvCompleted_SelectionChanged(object sender, EventArgs e) { if (dgvProcessing.SelectedRows.Count > 0) { dgvProcessing.ClearSelection(); } try { string category = dgvCompleted.SelectedRows[0].Cells[0].Value.ToString(); if (category == "IT技術支援") { DataFormSupport form = new DataFormSupport("completed"); form.ChangedEvent += new EventHandler(form_ChangedEvent); LoadControl(form); } else if (category == "資產外借") { DataFormAsset form = new DataFormAsset("completed"); LoadControl(form); } else if (category == "權限及軟件安裝") { DataFormPermission form = new DataFormPermission("completed"); LoadControl(form); } else if (category == "工具開發/修改") { DataFormDevelop form = new DataFormDevelop("completed"); LoadControl(form); } else if (category == "IT意見箱") { DataFormComment form = new DataFormComment("completed"); LoadControl(form); } else if (category == "R3申請") { DataFormR3 form = new DataFormR3("completed"); LoadControl(form); } else { return; } } catch { //dgvCompleted.ClearSelection(); } }
public FormView2() { InitializeComponent(); InitializeList(); //dgvProcessing.DefaultCellStyle.SelectionBackColor = dgvProcessing.DefaultCellStyle.BackColor; //dgvProcessing.DefaultCellStyle.SelectionForeColor = dgvProcessing.DefaultCellStyle.ForeColor; dgvCompleted.DefaultCellStyle.SelectionBackColor = SystemColors.ControlLightLight; dgvCompleted.DefaultCellStyle.SelectionForeColor = Color.Black; DataFormSupport form = new DataFormSupport("processing"); form.ChangedEvent += new EventHandler(form_ChangedEvent); LoadControl(form); dgvProcessing.Rows[0].Selected = true; Application.Idle += new EventHandler(Application_Idle); }