0

i have a combobox that have items form database. the problem is when i selected an item from that combobox it disappeared but still in the choices. i want the combobox.selecteditem should be appearing if i selected it.

here's my code :

Dim strsql = "select * from DesignationEveryDept where Department = '" & DeptNameCB.Text & "'"
        Dim acscmd As New OleDb.OleDbCommand
        acscmd.CommandText = strsql
        acscmd.Connection = asconn
        acsdr = acscmd.ExecuteReader()
        DesEmpCB.Items.Clear()
        While (acsdr.Read())
            DesEmpCB.Items.Add(acsdr("Designation"))
        End While
        acscmd.Dispose()
        acsdr.Close()

kindly help me. thank you in advance~

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by paoi00
0

What you mean about disappeared? you mean remove selected item from combobox?

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    ComboBox1.Items.Remove(ComboBox1.SelectedItem)
End Sub
0

no. what is happening now is when i selected item, it is refreshed and not selected. :(

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.