private void buttonOrders_Click(object sender, EventArgs e) { if (DataGridView1.Rows.Count < 1) { return; } fieldId = (int)this.DataGridView1.CurrentRow.Cells[0].Value; if (fieldId > 0) { decimal currentBalance = 0; decimal.TryParse(this.DataGridView1.CurrentRow.Cells[22].Value.ToString(), out currentBalance); CustomerOrders f1 = new CustomerOrders( fieldId, DataGridView1.CurrentRow.Cells[1].Value.ToString(), String.Format("{0} {1}, {2} {3}, {4}, {5}", DataGridView1.CurrentRow.Cells[3].Value.ToString().Trim(), DataGridView1.CurrentRow.Cells[4].Value.ToString().Trim(), DataGridView1.CurrentRow.Cells[5].Value.ToString().Trim(), DataGridView1.CurrentRow.Cells[6].Value.ToString().Trim(), DataGridView1.CurrentRow.Cells[7].Value.ToString().Trim(), DataGridView1.CurrentRow.Cells[8].Value.ToString().Trim()), currentBalance ); //solumCustomerCheckBox.Checked = (bool)DataGridView1.CurrentRow.Cells[20].Value; //quickDropCustomerCheckBox.Checked = (bool)DataGridView1.CurrentRow.Cells[21].Value; //if (solumCustomerCheckBox.Checked // && quickDropCustomerCheckBox.Checked) // f1.customerType = -1; //both //else if (solumCustomerCheckBox.Checked) // f1.customerType = 0; //solum //else if (quickDropCustomerCheckBox.Checked) // f1.customerType = 1; //quickdrop if (DataGridView1.Columns[22].Visible) { f1.customerType = 0; //solum } else if (DataGridView1.Columns[23].Visible) { f1.customerType = 1; //quickdrop } f1.ShowDialog(); f1.Dispose(); f1 = null; //refresh this.TableAdapter1.Fill(this.DataSet1.sol_Customers, customerType, textBoxName.Text, activeType); BindingSource1.Position = BindingSource1.Find("CustomerID", fieldId); ////balance //this.DataGridView1.CurrentRow.Cells[14].Value = f1.currentBalance; ////this.DataGridView1.CurrentRow.Cells[14] = f1.currentBalance; } else { MessageBox.Show("Nothing to show!"); } }