mysql - How to delete an item from combobox during runtime after deleting from the database -


  private sub btn_remove_Click (ByVal as the System.Object, ByVal e System.EventArgs) as handle btn_remove.Click dim query string dim QUERY1 string integer as in as dim i = 0 i = DataGridView1.CurrentRow.Index dim strValueYouWant string = String.Empty strValueYouWant = DataGridView1.Item (0, i) .Value dim result1 as DialogResult = as MessageBox.Show ( "", then MessageBoxButtons.YesNo) result1 = DialogResult.Yes then mysqlconn.Open () query = "do you want to delete your selected line, sure", _ "Remove important question from table1 where show_id = '" & amp; StrValueYouWant & amp; "" Retarded MySqlCommand = new MySqlCommand (query, mysqlconn) dim K = integer CmdkExecuteNonQuery (as) query = nothing cmd.Dispose () selected cmd = "table1 as QUERY1 *" New MySqlCommand (QUERY1, mysqlconn as cmd1 dim) slow reader MySqlDataReader = cmd1.ExecuteReader as in the form of a new table of dataTable () table.Load (reader) DataGridView1.DataSource = Table QUERY1 = nothing elseif result1 = DialogResult.No then mysqlconn.Close (Exit sub end) end sub  

selects an item I Kanboboks above address and I said dataset Prepares the table by using it and displays it in the datagrid. Then I click the delete button. Before being removed from the database but here I want to delete the run Knbobaks the item. I'm already using one of the codes above to choose two questions and if I do not work with user loading method then it is not working because the connection is already open error. .

refer to this site

You can use the function Remove combo with RemoveItem

YourCombo.RemoveItem (index)

or yourCombo.Clear () And reload it


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -