how to remove selected item from combobox

we tried this code but some error in this statement

cbocode.Items.RemoveAt(cbocode.SelectedText)

cbocode.Items.RemoveAt(cbocode.SelectedIndex)

alternatively :

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    ComboBox1.Items.Remove(ComboBox1.SelectedItem)
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.