Im new on C# i made an application which shows employees names, their city and their number etc. The datagridview bring data form online mysql database. When I click datagridview, the datas on datagridview is writen the textbox above... So i can delete or update an employee or add new one... Everything is ok till here...
But When i filtered datagridview data from a textbox (filter works meanwhlie) the datagridview double click event doesnt work and the application closed...
int secilen = dataGridView1.SelectedCells[0].RowIndex;
txtid.Text = dataGridView1.Rows[secilen].Cells[0].Value.ToString();
txtDb.Text = dataGridView1.Rows[secilen].Cells[1].Value.ToString();
txtsicil.Text = dataGridView1.Rows[secilen].Cells[2].Value.ToString();
txtBitTar.Text = dataGridView1.Rows[secilen].Cells[3].Value.ToString();
cmbEgtAd.Text = dataGridView1.Rows[secilen].Cells[4].Value.ToString();
and here my filter coddes
baglanti.Open();
MySqlCommand komutbulx = new MySqlCommand("Select * from Tbl_Yerinde Where sicilid like '%" + txtsicil.Text + "%'", baglanti);
DataTable dtx = new DataTable();
MySqlDataAdapter dax = new MySqlDataAdapter(komutbulx);
dax.Fill(dtx);
dataGridView1.DataSource = dtx;
baglanti.Close();
Aa far as i understand the problem is the index bring from datagridwiev. When its filtered brought index is not true... But how can I solve this?