private void BTM_SELECT_CUSTOMER_Click(object sender, EventArgs e) { try { FRM_CUSTOMERS_LIST CUST_LIST = new FRM_CUSTOMERS_LIST(); CUST_LIST.ShowDialog(); this.TXT_CUSTOMER_ID.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[0].Value.ToString(); this.TXT_FNAME.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[1].Value.ToString(); this.TXT_LNAME.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[2].Value.ToString(); this.TXT_PHONE.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[3].Value.ToString(); this.TXT_EMAIL.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[4].Value.ToString(); } catch { } }
private void BTM_SELECT_CUSTOMER_Click(object sender, EventArgs e) { try { //DataGridView dgv1 = new DataGridView(); FRM_CUSTOMERS_LIST CUST_LIST = new FRM_CUSTOMERS_LIST(); CUST_LIST.ShowDialog(); this.TXT_CUSTOMER_ID.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[0].Value.ToString(); this.TXT_FNAME.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[1].Value.ToString(); this.TXT_LNAME.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[2].Value.ToString(); this.TXT_PHONE.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[3].Value.ToString(); this.TXT_EMAIL.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[4].Value.ToString(); this.TXT_ID_CUSTOMER_TAKSEET.Text = CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[0].Value.ToString(); //this.TXT_TOTAL_PRICE_TAKSEET.Text = frm.GET_CUSTOMER_TOTAL_AMOUNT(Convert.ToInt32(TXT_CUSTOMER_ID.Text)).Rows[0][0].ToString(); //dgv1.DataSource = frm.GET_CUSTOMER_TOTAL_AMOUNT(Convert.ToInt32(TXT_CUSTOMER_ID.Text)); dataGridView1.DataSource = frm.GET_CUSTOMER_TOTAL_AMOUNT(Convert.ToInt32(TXT_CUSTOMER_ID.Text)); //int sum = 0; string[] arr = new string[dataGridView1.Rows.Count]; for (int i = 0; i < arr.Length; i++) { // arr[i]= Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString()); arr[i] = dataGridView1.Rows[i].Cells[0].Value.ToString(); } double sum = 0.0; for (int i = 0; i < arr.Length; i++) { // arr[i]= Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString()); sum += Convert.ToDouble(arr[i]); } TXT_TOTAL_PRICE_TAKSEET.Text = sum.ToString(); //sum += Convert.ToInt32(dgv1.Rows[0].Cells[0].Value.ToString()); //TXT_TOTAL_PRICE_TAKSEET.Text = sum.ToString(); //TXT_TOTAL_PRICE_TAKSEET.Text = sum.ToString(); //CUST_LIST.DGV_CUSTOMERS.CurrentRow.Cells[1].Value.ToString(); } catch { } }