private void button2_Click(object sender, EventArgs e) { AracGuncelle aracguncelle = new AracGuncelle(); aracguncelle.Show(); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1[0, 0].Value == null) { MessageBox.Show("Veri Bulunmamaktadır"); } else { if (e.ColumnIndex == dataGridView1.Columns["sil"].Index) { if (MessageBox.Show("Silmek istediğinize emin misiniz ? ", "DİKKAT", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string silme = "Delete from tblArac where plaka='" + dataGridView1.CurrentRow.Cells[dataGridView1.Columns["plaka"].Index].Value.ToString() + "'"; SqlCommand com = new SqlCommand(silme, baglanti); com.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter("select * from tblArac", baglanti); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; } } if (e.ColumnIndex == dataGridView1.Columns["guncelle"].Index) { AracGuncelle gunce = new AracGuncelle(); gunce.marka.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); gunce.model.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); gunce.plaka.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); gunce.yakit.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); gunce.motorguc.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); gunce.tork.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); gunce.motorhacim.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString(); gunce.renk.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString(); gunce.vites.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString(); if (dataGridView1.CurrentRow.Cells[10].Value.ToString() == "True") { gunce.klimavar.Checked = true; } else { gunce.klimayok.Checked = true; } if (dataGridView1.CurrentRow.Cells[12].Value.ToString() == "True") { gunce.sigortavar.Checked = true; } else { gunce.sigortayok.Checked = true; } gunce.ruhsat.Text = dataGridView1.CurrentRow.Cells[11].Value.ToString(); gunce.muayene.Text = dataGridView1.CurrentRow.Cells[13].Value.ToString(); gunce.ucret.Text = dataGridView1.CurrentRow.Cells[14].Value.ToString(); gunce.label15.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); this.Hide(); gunce.Show(); } } }