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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After update on a Combo Box 2

Status
Not open for further replies.

Modex

Programmer
Sep 15, 2002
155
GB
Hi all,

Sorry for a very "newbie" question, Ive just started getting involved in VB6, (mainly work on VBA in MSacces.)

Could anyone please tell me how to launch a command after a option is located in a combo Box.

For Example in a Cmmbo box list, I may have Paintshop, Pageplus and Winword. What I would like to do is select one, lets say Winword,and once selected the winword program would run, rather than have to click another command button taking the value of the combo box to launch the program.

If I code in on the Combobox the following, nothing happens:

if combo1 = "windword" then
Dim ad as string
ad = Shell(c:\Program Files\MSoffice\winword.exe,vbMaximizedFocus)

nothing happens.



I hope thats understandable

Many thanks

ModeX
 
Hi Modex,

Use the Click event of the combo box to get the Text property e.g.

Private Sub combo1_Click()

if (combo1.Text = "windword") then
Dim ad as string
ad = Shell(c:\Program Files\MSoffice\winword.exe,vbMaximizedFocus)

End Sub
 
Hi Modex.
In VB6, you can use the Change() event and be a bit trickier:

Option Explicit
Const wrd = "C:\Program Files\...\Winword.exe"
Const psp="C:\...\Psp.exe"
...

Private Sub Combo1_Change()
Dim app as str
Select Case Combo1.Text
Case "Winword"
app=wrd
Case "Paintshop"
app=psp
..
End Select

AppActivate Shell(app,vbmaximizedfocus),1
End Sub

;-)

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top