×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ComboBox Question

ComboBox Question

ComboBox Question

(OP)
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

RE: ComboBox Question

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

RE: ComboBox Question

(OP)
hi Lakare,

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

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



thanks
rem

RE: ComboBox Question

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

RE: ComboBox Question

(OP)
Lakare,

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

rem

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close