2014-11-04 66 views
0

我把下面的代碼上ComboBox1.SelectedIndexChanged並在第一時間沒關係,但如果我改變組合的價值在DataGridView包含與年輕人:(VB.net DataGridView中顯示不正確時更改數據

新值
Adapter.SelectCommand = New MySqlCommand("SELECT * FROM table where id_user = " & ComboBox1.SelectedValue.ToString & ";", cn) 
Adapter.Fill(AppDataSet11.timbrature) 
DataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells) 

回答

1

你需要清除DataGridView你把新的值之前。

DataGridView1.Rows.Clear() 
+0

謝謝你,我想你的解決方案,但返回錯誤「無法刪除此列表」後,我意識到,我必須清理關聯的數據集,再次感謝您 – Rinos 2014-11-05 10:28:13