private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridView.CurrentRow.Index >= dataGridView.RowCount - 1) { return; } id.Text = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString(); int Id = int.Parse(id.Text); ShowFreight(Id); freights Freight = Functions.FindFreights(Id); if (dataGridView1.CurrentCell.ColumnIndex == 1) { CargoForm CF = new CargoForm(Freight.CargoId); CF.Show(); return; } if (dataGridView1.CurrentCell.ColumnIndex == 2) { CompaniesForm CF = new CompaniesForm(Freight.From); CF.Show(); return; } if (dataGridView1.CurrentCell.ColumnIndex == 3) { CompaniesForm CF = new CompaniesForm(Freight.To); CF.Show(); return; } }
private void button3_Click(object sender, EventArgs e) { CargoForm CF = new CargoForm(); CF.Show(); }
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridView.CurrentRow.Index >= dataGridView.RowCount - 1) { return; } id.Text = dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString(); int Id = int.Parse(id.Text); ShowFreight(Id); freights Freight = Functions.FindFreights(Id); if(dataGridView1.CurrentCell.ColumnIndex == 1) { CargoForm CF = new CargoForm(Freight.CargoId); CF.Show(); return; } if (dataGridView1.CurrentCell.ColumnIndex == 2) { CompaniesForm CF = new CompaniesForm(Freight.From); CF.Show(); return; } if (dataGridView1.CurrentCell.ColumnIndex == 3) { CompaniesForm CF = new CompaniesForm(Freight.To); CF.Show(); return; } }