private void mmu_EditCar_Click(object sender, EventArgs e) { //if (Grid.SelectedRows.Count == 0) return; //int selectedIndex = Grid.SelectedRows[0].Index; //int rowId = Convert.ToInt32(Grid["id", selectedIndex].Value); //FormAddCar form = new FormAddCar(); //form.RowId = rowId; //if(form.ShowDialog() == DialogResult.OK) //{ // Refresh(); //} if (Grid.SelectedRows.Count == 0) { return; } int selectedIndex = Grid.SelectedRows[0].Index; int rowId = Convert.ToInt32(Grid["id", selectedIndex].Value); FormAddCar form = new FormAddCar(); form.RowId = rowId; if (form.ShowDialog() == DialogResult.OK) { RefreshData(); } }
private void AddNewCar() { FormAddCar form = new FormAddCar(); if (form.ShowDialog() == DialogResult.OK) { RefreshData(); } }
private void mnuEdit_Click(object sender, EventArgs e) { if (grid.SelectedRows.Count == 0) { return; } int selectedIndex = grid.SelectedRows[0].Index; int rowId = Convert.ToInt32(grid["id", selectedIndex].Value); FormAddCar form = new FormAddCar(); form.rowId = rowId; if (form.ShowDialog() == DialogResult.OK) { RefreshData(); } }
private void mnuEditCar_Click(object sender, EventArgs e) { if (grid.SelectedRows.Count == 0) { return; //jesli kolekcja jest pusta to nic nie moge edytowac } int selectedIndex = grid.SelectedRows[0].Index; int rowId = Convert.ToInt32(grid["id", selectedIndex].Value); FormAddCar form = new FormAddCar(); form.RowId = rowId; if (form.ShowDialog() == DialogResult.OK) { RefreshData(); } }