Button5









How do I use Button5
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: frmQuanLy_Admin.cs Copy
36         private void button5_Click(object sender, EventArgs e)
37         {
38             frmQuanLySinhVien qlsv = new frmQuanLySinhVien();
39             qlsv.Show();
40         }
File name: Form1.cs Copy
228   public void Button5_Click(System.Object sender, System.EventArgs e)
229   {
230    newgrade = gradeclass.DataModule.GetLoad();
231    DataGridView1.DataSource = newgrade;
232    DataGridView1.DataMember = "grade1";
233
234   }
File name: frmSalesRecord1.cs Copy
336         private void Button5_Click(object sender, EventArgs e)
337         {
338             try
339             {
340                 GroupBox10.Visible = true;
341                 con = new SqlConnection(cs.DBConn);
342                 con.Open();
343                 cmd = new SqlCommand("SELECT RTRIM(invoiceNo) as [Order No],RTRIM(InvoiceDate) as [Order Date],RTRIM(Invoice_Info.CustomerID) as [Customer ID],RTRIM(CustomerName) as [Customer Name],RTRIM(SubTotal) as [SubTotal],RTRIM(VATPer) as [Vat+ST %],RTRIM(VATAmount) as [VAT+ST Amount],RTRIM(DiscountPer) as [Discount %],RTRIM(DiscountAmount) as [Discount Amount],RTRIM(GrandTotal) as [Grand Total],RTRIM(TotalPayment) as [Total Payment],RTRIM(PaymentDue) as [Payment Due],RTRIM(PaymentType) as [Payment Type],RTRIM(Status) as [Status],Remarks from Invoice_Info,Customer where Invoice_Info.CustomerID=Customer.CustomerID and InvoiceDate between @d1 and @d2 and PaymentDue > 0 order by InvoiceDate desc", con);
344                 cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "InvoiceDate").Value = DateTimePicker2.Value.Date;
345                 cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "InvoiceDate").Value = DateTimePicker1.Value.Date;
346                 SqlDataAdapter myDA = new SqlDataAdapter(cmd);
347                 DataSet myDataSet = new DataSet();
348                 myDA.Fill(myDataSet, "Invoice_Info");
349                 myDA.Fill(myDataSet, "Customer");
350                 DataGridView2.DataSource = myDataSet.Tables["Customer"].DefaultView;
351                 DataGridView2.DataSource = myDataSet.Tables["Invoice_Info"].DefaultView;
352                 Int64 sum = 0;
353                 Int64 sum1 = 0;
354                 Int64 sum2 = 0;
355
356                 foreach (DataGridViewRow r in this.DataGridView2.Rows)
357                 {
358                     Int64 i = Convert.ToInt64(r.Cells[9].Value);
359                     Int64 j = Convert.ToInt64(r.Cells[10].Value);
360                     Int64 k = Convert.ToInt64(r.Cells[11].Value);
361                     sum = sum + i;
362                     sum1 = sum1 + j;
363                     sum2 = sum2 + k;
364                 }
365                 TextBox12.Text = sum.ToString();
366                 TextBox11.Text = sum1.ToString();
367                 TextBox10.Text = sum2.ToString();
368
369                 con.Close();
370             }
371             catch (Exception ex)
372             {
373                 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
374             }
375         }
File name: frmSalesRecord2.cs Copy
335         private void Button5_Click(object sender, EventArgs e)
336         {
337             try
338             {
339                 GroupBox10.Visible = true;
340                 con = new SqlConnection(cs.DBConn);
341                 con.Open();
342                 cmd = new SqlCommand("SELECT RTRIM(invoiceNo) as [Order No],RTRIM(InvoiceDate) as [Order Date],RTRIM(Invoice_Info.CustomerID) as [Customer ID],RTRIM(CustomerName) as [Customer Name],RTRIM(SubTotal) as [SubTotal],RTRIM(VATPer) as [Vat+ST %],RTRIM(VATAmount) as [VAT+ST Amount],RTRIM(DiscountPer) as [Discount %],RTRIM(DiscountAmount) as [Discount Amount],RTRIM(GrandTotal) as [Grand Total],RTRIM(TotalPayment) as [Total Payment],RTRIM(PaymentDue) as [Payment Due],RTRIM(PaymentType) as [Payment Type],RTRIM(Status) as [Status],Remarks from Invoice_Info,Customer where Invoice_Info.CustomerID=Customer.CustomerID and InvoiceDate between @d1 and @d2 and PaymentDue > 0 order by InvoiceDate desc", con);
343                 cmd.Parameters.Add("@d1", SqlDbType.DateTime, 30, "InvoiceDate").Value = DateTimePicker2.Value.Date;
344                 cmd.Parameters.Add("@d2", SqlDbType.DateTime, 30, "InvoiceDate").Value = DateTimePicker1.Value.Date;
345                 SqlDataAdapter myDA = new SqlDataAdapter(cmd);
346                 DataSet myDataSet = new DataSet();
347                 myDA.Fill(myDataSet, "Invoice_Info");
348                 myDA.Fill(myDataSet, "Customer");
349                 DataGridView2.DataSource = myDataSet.Tables["Customer"].DefaultView;
350                 DataGridView2.DataSource = myDataSet.Tables["Invoice_Info"].DefaultView;
351                 Int64 sum = 0;
352                 Int64 sum1 = 0;
353                 Int64 sum2 = 0;
354
355                 foreach (DataGridViewRow r in this.DataGridView2.Rows)
356                 {
357                     Int64 i = Convert.ToInt64(r.Cells[9].Value);
358                     Int64 j = Convert.ToInt64(r.Cells[10].Value);
359                     Int64 k = Convert.ToInt64(r.Cells[11].Value);
360                     sum = sum + i;
361                     sum1 = sum1 + j;
362                     sum2 = sum2 + k;
363                 }
364                 TextBox12.Text = sum.ToString();
365                 TextBox11.Text = sum1.ToString();
366                 TextBox10.Text = sum2.ToString();
367
368                 con.Close();
369             }
370             catch (Exception ex)
371             {
372                 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
373             }
374         }
File name: frmStockRecord.cs Copy
169         private void button5_Click(object sender, EventArgs e)
170         {
171             try
172             {
173                 if (txtProductname.Text == "")
174                 {
175                     MessageBox.Show("Please enter product name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
176                     txtProductname.Focus();
177                     return;
178                 }
179                 Cursor = Cursors.WaitCursor;
180                 timer1.Enabled = true;
181                 rptStock rpt = new rptStock();
182                 //The report you created.
183                 cmd = new SqlCommand();
184                 SqlDataAdapter myDA = new SqlDataAdapter();
185                 POS_DBDataSet myDS = new POS_DBDataSet();
186                 //The DataSet you created.
187                 con = new SqlConnection(cs.DBConn);
188                 cmd.Connection = con;
189                 cmd.CommandText = "SELECT * from Stock,Product,Supplier where Stock.ProductID=Product.ProductID and Stock.SupplierID=Supplier.SupplierID and ProductName like '" + txtProductname.Text + "%' order by StockDate";
190                 cmd.CommandType = CommandType.Text;
191                 myDA.SelectCommand = cmd;
192                 myDA.Fill(myDS, "Stock");
193                 myDA.Fill(myDS, "Product");
194                 myDA.Fill(myDS, "Supplier");
195                 rpt.SetDataSource(myDS);
196                 frmStockReport frm = new frmStockReport();
197                 frm.crystalReportViewer1.ReportSource = rpt;
198                 frm.Visible = true;
199             }
200             catch (Exception ex)
201             {
202                 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
203             }
204         }

Download file with original file name:Button5

Button5 120 lượt xem

Gõ tìm kiếm nhanh...