I am trying to create an all in one program which basically has three drop down boxes(combo boxes) and an Installer button for each. I want to be able to scroll through any three list and hit the install button to make it happen.

I have been searching around for some reference material in order to link these boxes and buttons to the .exe installers. Does anyone have some useful material or can any one have a snip of code I can work off of.

I am a coding nub please help.

Recommended Answers

All 5 Replies

Guess I'm not quite sure what you want to do, but if you want to sun the Windows Installer you can Shell the installer with the MSI file as a parameter. For example:

Ret = Shell("MSIEXEC /I " & Combo1.Text, vbNormalFocus)

Assuming Combo1.Text contains the name of the .MSI file.

If the file has spaces in the name, be sure to include quotes:

Ret = Shell("MSIEXEC /I " & Chr$(34) & Combo1.Text & Chr$(34), vbNormalFocus)

Basically it would look something like this:

http://i41.tinypic.com/157necz.jpg

I want to be able link the list in these drop down boxes to another folder that have certain programs in it and be able to install them from this menu.

Yes I could just have the installers all in folders on a disk. But I just to be able to use a interface like this.

Would this be difficult to do?

Thanks for any more help.

Lets combine what SCBWV wrote and arrays for "linking".

Use arrays to hold names in combo box(es) and actual filepaths

Private InstNames() As String
Private InstPaths() As String

Private Sub Form_Load()
'
  ReDim InstNames(1)
  ReDim InstPaths(1)
  InstNames(0) = "MyApp"
  InstPaths(0) = "C:\Installers\file.msi"
  Combo1.AddItem InstNames(0)

End Sub

Private Sub Command1_Click()
'
Dim IX As Integer
Dim Ret As Double

  IX = Combo1.ListIndex

  If IX >= 0 Then
    Ret = Shell("MSIEXEC /I " & Chr$(34) & InstPaths(IX) & Chr$(34), vbNormalFocus)
    ' or, for EXE files Ret = Shell("CMD " & Chr$(34) & InstPaths(IX) & Chr$(34), vbNormalFocus)
  End If

End Sub

Of course, you'll need three pairs of arrays, three combos and three buttons in your case.

Ugh Im completely lost... Have any of you tried something like this. Is there any type or tutorial or reference that would get me started in the right place?

To be honest, no :)

I was a bit lazy and didn't test what I wrote, sorry. Here's my previous code, slightly modified and with a bug fix:

Private InstNames() As String
Private InstPaths() As String

Private Sub Form_Load()
'
  ReDim InstNames(1)
  ReDim InstPaths(1)
  InstNames(0) = "MyApp"
  ' Use fully qualified paths for Shell
  InstPaths(0) = "C:\Installers\file.exe"
  Combo1.AddItem InstNames(0)

End Sub

Private Sub Command1_Click()
'
Dim IX As Integer
Dim Ret As Double

  IX = Combo1.ListIndex

  If IX >= 0 Then
    Ret = Shell(Chr$(34) & InstPaths(IX) & Chr$(34), vbNormalFocus)
  End If

End Sub

At which point you did get "lost"? You can also post your code, so we might be able to see what's wrong with it.

I don't think there's any tutorials for this particular problem. If you mean programming with VB6 generally, there's tutorials and code samples in the net.

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.