ComboBox with an editable function

  • Thread starter Thread starter bostonlady
  • Start date Start date
B

bostonlady

Does anyone know how to create a list box to allow the user to choos
AND allow the user to enter new data if he/she selects one item fro
the list? For example "other" would allow the user to add an item
 
When "other" is clicked, some entry field component of some sort becomes visible, maybe
even modal, and when entry there is complete, this entry gets transferred to the listbox
and selected. It takes several components and some VBA of coding to do since you can't
type into a listbox.
 
This is a quite primitive solution, using Windows' inputbox:

Private Sub ListBox1_Click()
Dim S As String
If ListBox1.Text = "Other" Then
S = InputBox("Enter new item:")
If S <> "" Then _
ListBox1.AddItem S, _
ListBox1.ListIndex
End If
End Sub
 
Back
Top