danieltur
08-17-2018, 04:41 PM
Hi everybody,
I am a beginner with VBA, and need a little bit of help.
I am developing an application, in which I create checkboxes textboxes, comboboxes and listboxes.
I have a problem with the list boxes.
Here is my code:
Dim lecontrol As Control
Set lecontrol =userform1.controls.Add("forms.listbox.1", 1)
With lecontrol
.Top = dtopbx
.Left = leftoffset
.Name = "field" & huf- 1
.Width = dwidth
.SetFocus
End With
The result is the following: theUserForm displays the list of items, with a horizontal scrollbar and a verticalscrollbar, but there is no associated textbox zone, where the selectionnormally appears.
And I cannot select any item (please see attached picture).
If I replace in my code userform1.controls.Add("forms.listbox.1",1) with userform1.controls.Add("forms.combobox.1", 1), I create a"proper" Combobox, displayed and operating properly.
So, what's could be wrong with mycode?
Anybody?
Many thanks in advance for your kindhelp and your time.
I am a beginner with VBA, and need a little bit of help.
I am developing an application, in which I create checkboxes textboxes, comboboxes and listboxes.
I have a problem with the list boxes.
Here is my code:
Dim lecontrol As Control
Set lecontrol =userform1.controls.Add("forms.listbox.1", 1)
With lecontrol
.Top = dtopbx
.Left = leftoffset
.Name = "field" & huf- 1
.Width = dwidth
.SetFocus
End With
The result is the following: theUserForm displays the list of items, with a horizontal scrollbar and a verticalscrollbar, but there is no associated textbox zone, where the selectionnormally appears.
And I cannot select any item (please see attached picture).
If I replace in my code userform1.controls.Add("forms.listbox.1",1) with userform1.controls.Add("forms.combobox.1", 1), I create a"proper" Combobox, displayed and operating properly.
So, what's could be wrong with mycode?
Anybody?
Many thanks in advance for your kindhelp and your time.