private void Frm_Load(object sender, EventArgs e) { try { List <String> list = LocalPrinter.GetLocalPrinters(); //获得系统中的打印机列表 DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Printer"; dt.Columns.Add(dc); foreach (String s in list) { DataRow dr = dt.NewRow(); dr["Printer"] = s; dt.Rows.Add(dr); } lookUpEditPrinter.Properties.DataSource = dt; lookUpEditPrinter.EditValue = LocalPrinter.DefaultPrinter(); DbHelperSQL.connectionString = Conn; dateEdit1.DateTime = BaseFunction.ReturnDate(DateTime.Today.ToString("yyyy-MM-01")); dateEdit2.DateTime = BaseFunction.ReturnDate(DateTime.Today.AddMonths(1).ToString("yyyy-MM-01")).AddDays(-1); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { liSOsID.Text = ""; if (sUserID.ToLower() == "demo") { btnPrintSet.Visible = true; } else { btnPrintSet.Visible = false; } List <String> list = LocalPrinter.GetLocalPrinters(); //获得系统中的打印机列表 DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Printer"; dt.Columns.Add(dc); foreach (String s in list) { DataRow dr = dt.NewRow(); dr["Printer"] = s; dt.Rows.Add(dr); } lookUpEditPrinter.Properties.DataSource = dt; lookUpEditPrinter.EditValue = LocalPrinter.DefaultPrinter(); DbHelperSQL.connectionString = Conn; SetLookUp(); string sSQL = sSQLGrid; sSQL = sSQL.Replace("1=1", "1=-1"); dtGrid = DbHelperSQL.Query(sSQL); dtPrint = dtGrid.Copy(); btnTxtBarCode.Focus(); sPrintLayOutMod = sPrintLayOutMod.Replace("aaaaaaaa", lookUpEditFlowType.Text.Trim()); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { if (sUserID.ToLower() == "demo") { btnPrintSet.Visible = true; } else { btnPrintSet.Visible = false; } List <String> list = LocalPrinter.GetLocalPrinters(); //获得系统中的打印机列表 DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Printer"; dt.Columns.Add(dc); foreach (String s in list) { DataRow dr = dt.NewRow(); dr["Printer"] = s; dt.Rows.Add(dr); } lookUpEditPrinter.Properties.DataSource = dt; lookUpEditPrinter.EditValue = LocalPrinter.DefaultPrinter(); dateEdit1.DateTime = DateTime.Today; dateEdit2.DateTime = DateTime.Today; DbHelperSQL.connectionString = Conn; SetLookUp(); btnRePrintLabel.Enabled = false; btnPrintLabel.Enabled = true; radioUnPrint.Checked = true; } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }