Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox Question 1

Status
Not open for further replies.

remy988

Technical User
Mar 29, 2012
128
US
hi,

Is there a way to show the first value (in this case, the value is Sedan) on the drop down without selecting the down arrow?

Code:
Sub Main
    Dim Make(2) as String
    Make(0) = "Sedan"
    Make(1) = "Truck"
    Make(2) = "SUV" 
    
    Begin Dialog dlgOptions 10, 28, 100, 100, "Select"
    
    OkButton      60, 20, 20, 10,.btnOK
    DropComboBox  10, 20, 40, 20, Make(), .MakeComboBox

    End Dialog
    iDone = FALSE

    While (iDone = FALSE)    
        Dim dlgVar as dlgOptions
        nRet = Dialog(dlgVar)
        Select Case nRet
            Case -1                      
                iDone = TRUE
        End Select
    Wend
End Sub

thanks
rem
 
This should do it.

Code:
Declare Function dlgFunction(identifier$, action, suppvalue)

Sub Main
    Dim Make(2) as String 
    Make(0) = "Sedan" 
    Make(1) = "Truck" 
    Make(2) = "SUV" 
    Begin Dialog dlgOptions 10, 28, 100, 100, "Select", .dlgFunction
        OkButton 60, 20, 20, 10,.btnOK 
        DropComboBox 10, 20, 40, 20, Make(), .MakeComboBox 
    End Dialog 
    iDone = FALSE 
    While (iDone = FALSE) 
        Dim dlgVar as dlgOptions 
        nRet = Dialog(dlgVar) 
        Select Case nRet 
            Case -1 
                iDone = TRUE 
        End Select 
    Wend 
End Sub 

Function dlgFunction(identifier$, action, suppvalue)
    Select Case action
    Case 1 'Initialisation
        DlgValue("MakeComboBox"),0
    Case 2 'Button pressed
    Case 3 'Text og Combobox changed
    Case 4 'Focus changed
    Case 5 'Always happening
    End Select
End Function

Lakare
 
hi Lakare,

thanks for looking at this. i am receiving a compile error here:

[blue]Sub Function dlgFunction(identifier$, action, suppvalue)
Select Case action
Case 1 'Initialisation DlgValue("MakeComboBox"),0
Case 2 'Button pressed
Case 3 'Text og Combobox changed
Case 4 'Focus changed
Case 5 'Always happening
End Select
End Function[/blue]


thanks
rem
 
First of all.
Code:
Case 1 'Initialisation DlgValue("MakeComboBox"),0
needs to be in two lines, like this
Code:
Case 1 'Initialisation 
    DlgValue("MakeComboBox"),0
Second, does the whole function show as a compile error, or just a single line?
Code:
DlgValue("MakeComboBox"),0
And have you tried to copy/paste my whole code example into the compiler and then tried to run it?

Lakare
 
Lakare,

thanks for your help! i messed up on the Case 1 statement.

rem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top