private void Form1_Load(object sender, EventArgs e) { ver = "Scan IN&&Out (Ver3.0.0)"; lblTitle.Text = ver; try { LoadUC(); } catch (Exception) { } packinglistreport = new frmPackingListReport(); receivedreport = new frmReceivedReport(); packinglistreport.Show(); packinglistreport.Hide(); receivedreport.Show(); receivedreport.Hide(); if (!Connection.HasConnection()) { Form f = new Form(); f.StartPosition = FormStartPosition.CenterScreen; f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; UCConiction u = new UCConiction(); u.Mainfrm = this; f.Height = u.Height + 20; f.Width = u.Width + 20; f.Controls.Add(u); u.Dock = DockStyle.Fill; f.ShowDialog(); //Application.Restart(); return; //btnDataConnection_Click(btnDataConnection, e); //btnScanIN.Enabled = false; //btnScanOut.Enabled = false; //btnDataLog.Enabled = false; //btnPurchaseOrders.Enabled = false; //lblConnection.Text = "...No Connection! "; } else { System.Data.SqlClient.SqlConnection cn = Connection.GetConnection(); lblConnection.Text = "...Connected to: " + cn.Database; //cn.Close(); } }
void LoadUC() { configuration = new UCConfiguration(); pnlContent.Controls.Add(configuration); configuration.Left = 0; configuration.Top = 0; configuration.BringToFront(); configuration.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; configuration.Visible = false; configuration.f1 = this; CreatePurchaseOrders = new UCCreatePurchaseOrders(); pnlContent.Controls.Add(CreatePurchaseOrders); CreatePurchaseOrders.Left = 0; CreatePurchaseOrders.Top = 0; CreatePurchaseOrders.BringToFront(); // CreatePurchaseOrders.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; CreatePurchaseOrders.Visible = false; CreatePurchaseOrdersIndividually = new UCCreatePurchaseOrdersIndividually(); pnlContent.Controls.Add(CreatePurchaseOrdersIndividually); CreatePurchaseOrdersIndividually.Left = 0; CreatePurchaseOrdersIndividually.Top = 0; CreatePurchaseOrdersIndividually.BringToFront(); // CreatePurchaseOrders.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; CreatePurchaseOrdersIndividually.Visible = false; coniction = new UCConiction(); coniction.Mainfrm = this; pnlContent.Controls.Add(coniction); coniction.Left = 0; coniction.Top = 0; coniction.BringToFront(); coniction.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; coniction.Visible = false; dataLog = new UCDataLog(); dataLog.logdata = datalogObj; dataLog.f1 = this; pnlContent.Controls.Add(dataLog); dataLog.Left = 0; dataLog.Top = 0; dataLog.BringToFront(); dataLog.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; dataLog.Visible = false; scanOUT = new UCScanOUT(); pnlContent.Controls.Add(scanOUT); scanOUT.Left = 0; scanOUT.Top = 0; scanOUT.BringToFront(); scanOUT.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; scanOUT.Visible = false; scanOUT.frmMain = this; scanIN = new UCScanIN(); pnlContent.Controls.Add(scanIN); scanIN.Left = 0; scanIN.Top = 0; scanIN.BringToFront(); scanIN.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; scanIN.Visible = false; scanIN.frmMain = this; purchaseorders = new UCPurchaseOrders(); purchaseorders.frmMain = this; pnlContent.Controls.Add(purchaseorders); purchaseorders.Left = 0; purchaseorders.Top = 0; purchaseorders.BringToFront(); purchaseorders.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; purchaseorders.Visible = false; purchaseorderslog = new UCPurchaseOrdersLog(); purchaseorderslog.frmMain = this; pnlContent.Controls.Add(purchaseorderslog); purchaseorderslog.Left = 0; purchaseorderslog.Top = 0; purchaseorderslog.BringToFront(); purchaseorderslog.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; purchaseorderslog.Visible = false; }