private void btnShowEditInvoiceInfo_Click(object sender, EventArgs e) { int intRow; intRow = dataGridView1.CurrentRow.Index; if (dataGridView1.Rows.Count != 0) { if (dataGridView1.SelectedRows.Count > 0) { frmInvoiceInfo fo = new frmInvoiceInfo(); fo.strAction = "EDITINVOICE"; fo.ID = long.Parse(dataGridView1[0, intRow].Value.ToString()); fo.txtInvoiceNumber.Text = dataGridView1[1, intRow].Value.ToString(); fo.txtCustomerCode.Text = GetCustomerCodeByID(long.Parse(dataGridView1[4, intRow].Value.ToString())); fo.txtFDate.Text = dataGridView1[6, intRow].Value.ToString(); double dblTax = double.Parse(dataGridView1[7, intRow].Value.ToString()); fo.txtTax.Text = dblTax.ToString("#,##"); double dblPrice = double.Parse(dataGridView1[8, intRow].Value.ToString()); fo.txtPrice.Text = dblPrice.ToString("#,##"); fo.ShowDialog(); ShowLast100Invoices(); } else { MessageBox.Show("لطفا یک فاکتور را از جدول انتخاب کنید", "خطا"); } } }
private void btnNewInvoice_Click(object sender, EventArgs e) { frmInvoiceInfo fo = new frmInvoiceInfo(); fo.strAction = "NEWINVOICE"; fo.ShowDialog(); ShowLast100Invoices(); }