/// <summary> /// 改变待测表的界面datagridview /// </summary> public void ChangeMeter() { if (DGV_MeterInfo.InvokeRequired) { MyDelegate_meter Mdm = new MyDelegate_meter(ChangeMeter); this.Invoke(Mdm); } else { // this.dt_MeterInfoTableAdapter.Fill(this.myDataSet.Dt_MeterInfo); DataTable dt = this.dt_MeterInfoTableAdapter.GetData(); DGV_MeterInfo.AllowUserToAddRows = true; this.DGV_MeterInfo.Rows.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; this.DGV_MeterInfo.Rows.Add(); this.DGV_MeterInfo.Rows[i].Cells["MeterId"].Value = dr["MeterId"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterType"].Value = dr["MeterType"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterIcState"].Value = dr["MeterIcState"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterChuState"].Value = dr["MeterChuState"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterComState"].Value = dr["MeterComState"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterZhongState"].Value = dr["MeterZhongState"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterState"].Value = dr["MeterState"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterTest"].Value = dr["MeterTest"].ToString(); this.DGV_MeterInfo.Rows[i].Cells["MeterTime"].Value = ((DateTime)dr["MeterTime"]).ToString("MM-dd HH:mm"); this.DGV_MeterInfo.Rows[i].Cells["MeterCancel"].Value = dr["MeterCancel"].ToString().Equals("否") ? false : true; this.DGV_MeterInfo.Rows[i].Cells["MeterPrivilege"].Value = dr["MeterPrivilege"].ToString().Equals("0") ? false : true; } DGV_MeterInfo.ClearSelection(); Change_st(DGV_MeterInfo); DGV_MeterInfo.AllowUserToAddRows = false; } }
private void PlatManger_MouseDown(object sender, MouseEventArgs e) { DGV_MeterInfo.ClearSelection(); DGV_plat.ClearSelection(); if (der != null) { der.Close(); } // Showmsg("pp"); }
private void PlatManger_Load(object sender, EventArgs e) { try { // TODO: 这行代码将数据加载到表“myDataSet.Dt_success”中。您可以根据需要移动或删除它。 this.dt_PlateInfoTableAdapter.Fill(this.myDataSet.Dt_PlateInfo); ChangeMeter(); // TODO: 这行代码将数据加载到表“myDataSet.Dt_MeterInfo”中。您可以根据需要移动或删除它。 // this.dt_MeterInfoTableAdapter.Fill(this.myDataSet.Dt_MeterInfo); // this.dT_ResultTableAdapter.Fill(this.myDataSet.DT_Result,"完成"); // this.dT_BHGTableAdapter.Fill_BHG(this.myDataSet.DT_BHG, "不合格"); // this.dT_SBTableAdapter.Fill_SB(this.myDataSet.DT_SB, "失败"); } catch (Exception) { MessageBox.Show("数据库连接异常"); } DGV_MeterInfo.AllowUserToAddRows = false; DGV_plat.AllowUserToAddRows = false; DGV_MeterInfo.ClearSelection(); DGV_plat.ClearSelection(); DGV_HG.ClearSelection(); DGV_BHG.ClearSelection(); DGV_SB.ClearSelection(); fc = new FormControl(this); fc.GetInit(this, fc); this.formStartX = this.Width; this.formStartY = this.Height; Change_st(DGV_MeterInfo); Change_pl(DGV_plat); if (OpenServer()) { SetBtsetext("关闭服务", Color.Black); Lisenter(); } Dictionary <string, HeartInfo> h = CommonFunction.hearts; Dictionary <int, PlatInfo> he = CommonFunction.platInfos; }
private void Search_Load(object sender, EventArgs e) { if (!MysqlHepler.SqlOpen()) { MessageBox.Show("数据库连接失败!"); } string sql = "Select * From mygas_manufacture"; DataTable dt = MysqlHepler.SqlReturnDs(sql).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { CLB_changjia.Items.Add(dt.Rows[i]["ManufactureName"].ToString()); manufacture[dt.Rows[i]["id"].ToString()] = dt.Rows[i]["ManufactureName"].ToString(); } DGV_MeterInfo.Visible = true; DGV_result.Visible = false; DGV_MeterInfo.ClearSelection(); DGV_result.ClearSelection(); AutoSizeColumn(DGV_result); AutoSizeColumn(DGV_MeterInfo); }
private void DGV_MeterInfo_Leave(object sender, EventArgs e) { DGV_MeterInfo.ClearSelection(); }
private void TP_result_MouseDown(object sender, MouseEventArgs e) { DGV_MeterInfo.ClearSelection(); DGV_result.ClearSelection(); CLB_changjia.SelectedItems.Clear(); }