i have to make a program with only COMBO BOX and FORM and BUTTON.

the form should have 1-combo box (having many options)

and 1-Button

when user selects one option from combo box and presses button the form assign to that option should execute.

for eg. a combo box (options as apple,orange,grapes)

formapple----for APPLE option
formorange---for Orange option
formgrapes--for grapes options

when user will select 'Apple' and press Button...the form (eg.. formapple) should excute.

also is this possible to execute applications ?

A select case statement might help or you could use and if elseif structure...

Select Case Combo1.Text
Case "Orange"
  'formorange.show
Case "Apple"
  'formapple.show
Case "Grape"
  'formgrape.show
Case Else
  'sometimes the combo box may not have text in it...
End Select

Good Luck

you said option!!! somebody will misunderstand with it. cause option button is different thing in vb6. the above code is better for do. its nice vb5prgrmr. ok try another

If Combo1.Text = "apple" Then formapple.Show

Hi trytrytry,
Here is my help. suppose if you have 1 combo box called cboOption and 1 command button called cmdOpen then you can write code as under.

To add options in your combo box

Private Sub Form_Load()
cboOption.AddItem "Apple", 0
cboOption.AddItem "Orange", 1
cboOption.AddItem "Grapes", 2
End Sub

And to execute job as per above option selected by user, you can write below code.

Private Sub cmdOpen_Click()
Select Case cboOption.Text
Case "Apple"
formapple.Show
Case "Orange"
formorange.Show
Case "Grapes"
formgrapes.Show
End Select
End Sub


Good Luck

thank you all for helping..........

could i add items to combo box from database ? (instead of adding in form)

thank you all for helping..........

could i add items to combo box from database ? (instead of adding in form)

add mean? specific Item or load all Item in run time? details

add mean? specific Item or load all Item in run time? details

suppose i have data stored in database file

and when the program runs the data should be loaded in combo box

please check it.

abu taher...reply to my inbox message

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.