private void tblOrder_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = tblOrder.Rows[e.RowIndex]; int orderID = int.Parse(row.Cells[0].Value.ToString()); FormViewDetail viewDetail = new FormViewDetail() { OrderIDDetail = orderID }; viewDetail.Show(); } }
private void btnView_Click(object sender, EventArgs e) { if (orderID >= 0) { FormViewDetail viewDetail = new FormViewDetail() { OrderIDDetail = orderID }; viewDetail.Show(); } else { MessageBox.Show("Please choose an order to view"); } }