The dropdown combobox returns the number of the item that is selected. So if you select the first item in the dropdown list the dlg.DropListBox1 would return 0, 1 for the second item and so on. You would then use this number with the array of values that you used to populate the drop list to figure out which item was selected.
Dim list1$()
Begin Dialog NewDialog 32,25,150,150,"NewDialog", .NewDialog
OKButton 30,69,40,14, "OK", .OKButton1
DropListBox 33,23,89,11, list1$(), .DropListBox1
End Dialog
Option Explicit
Sub Main
Dim dlg As NewDialog
Dim button As Integer
ReDim list1$(4)
list1(0) = "red"
list1(1) = "blue"
list1(2) = "green"
list1(3) = "yellow"
list1(4) = "black"
button = Dialog(dlg)
MsgBox "You selected: " & list1(dlg.DropListBox1)
End Sub
Hello midhulm and welcome to
Hello midhulm and welcome to the site.
The dropdown combobox returns the number of the item that is selected. So if you select the first item in the dropdown list the dlg.DropListBox1 would return 0, 1 for the second item and so on. You would then use this number with the array of values that you used to populate the drop list to figure out which item was selected.