private void button1_Click(object sender, EventArgs e) { int selectedIndex = dataGridView1.CurrentCell.RowIndex; query.queryDeleteTechCard((int)dataGridView1.Rows[selectedIndex].Cells[0].Value); addGridView(query.querySelectTechCards()); }
public CardsListForm() { InitializeComponent(); query = new QueryTechnologicalCards(); this.Text = Properties.Resources.Cards; labelSearch.Text = Properties.Resources.Search; buttonCreate.Text = Properties.Resources.Create; buttonEdit.Text = Properties.Resources.Edit; button1.Text = Properties.Resources.Delete; button2.Text = Properties.Resources.Refresh; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.ReadOnly = true; dataGridView1.AllowUserToAddRows = false; dataGridView1.RowHeadersVisible = false; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; dataGridView1.ScrollBars = ScrollBars.Both; searchNameBox.Text = Properties.Resources.Title; buttonSearch.Text = Properties.Resources.Search; DataGridViewTextBoxColumn col0 = new DataGridViewTextBoxColumn(); col0.HeaderText = Properties.Resources.ID; DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); col1.HeaderText = Properties.Resources.Title; DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = Properties.Resources.InputGoods; DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); col3.HeaderText = Properties.Resources.OutputGoods; DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); col4.HeaderText = Properties.Resources.Date; dataGridView1.Columns.Add(col0); dataGridView1.Columns.Add(col1); dataGridView1.Columns.Add(col2); dataGridView1.Columns.Add(col3); dataGridView1.Columns.Add(col4); addGridView(query.querySelectTechCards()); }