Jump to content

VB install app


Recommended Posts

Hello, I am trying to make a VB that allows you to pick from a list of different applications such as flash, firefox, filezilla and so on.

I want to use check boxes so the user can pick what apps they want to install. The issue i'm havening is, i don't know how to get it to install one app then move onto the next, with the way i have it coed now, using the Shell command, all the apps try to run at one time, i kind of knew that would happen though.

I did some googling, but couldn't find anything that explained how to do this to well. I'm a n00b at programing, but understand it enough with some explanation of what each bit of code is doing.

any help i could get would be great, thanks!

Edited by lingk
Link to comment
Share on other sites


It would help if you posted the code, my powers of seeing other people code in my mind does not

work to good.

here is the code i have so far, again it's simple and ugly, I'm sure, though, that once i learn more it will look better.

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub cmdADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInstall.Click

'this is to see what check boxes are check, and install the seleted program'

Shell("firefox.exe", AppWinStyle.NormalFocus)

Else
MsgBox("Please Check Programs To Install")

End If


End Sub

Private Sub ckff_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ckff.CheckedChanged

End Sub

Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gpInternet.Enter

End Sub
End Class

Link to comment
Share on other sites

I do not know much about VB but VBS script is similar, so this is the way I would run a app and wait for it

to be completed.

Example VBS

Dim Fso, Shell 
Set Shell = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
If Fso.FileExists("Place\Path\To\Item") Then
Shell.Run("Place\Path\To\Item /Your Instal Switches"),1,True
End If

So it looks like from your code you are not passing ,1,True these

paramaters. Those mean normal window and wait for it to finish. I do not

know if VB allows for those paramaters.

Perhaps try this

Shell("firefox.exe", 1,True)

Link to comment
Share on other sites

looks like mist a part of the code when copying..

here is the correct code

	Private Sub cmdADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInstall.Click

'this is to see what check boxes are check, and install the seleted program'

If ckff.CheckState = 1 Then
'Shell("firefox.exe", AppWinStyle.NormalFocus)

Else
MsgBox("Please Check Programs To Install")

End If




End Sub

Link to comment
Share on other sites

I do not know much about VB but VBS script is similar, so this is the way I would run a app and wait for it

to be completed.

Example VBS

Dim Fso, Shell 
Set Shell = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
If Fso.FileExists("Place\Path\To\Item") Then
Shell.Run("Place\Path\To\Item /Your Instal Switches"),1,True
End If

So it looks like from your code you are not passing ,1,True these

paramaters. Those mean normal window and wait for it to finish. I do not

know if VB allows for those paramaters.

Perhaps try this

Shell("firefox.exe", 1,True)

I'll try giving this a try and see what happens.

Link to comment
Share on other sites

Well I got it to work, I took out the msg box because it was giving me issues, I want to bring it back, just need to figuer out how to do it.

anyways here is the code that allowed it to work

Private Sub cmdADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInstall.Click

'this is to see what check boxes are check, then install selected programs

If ckff.CheckState = CheckState.Checked Then
Shell("firefox.exe", AppWinStyle.NormalFocus, True)
End If
If ckFlash.CheckState = CheckState.Checked Then
Shell("flash.exe", AppWinStyle.NormalFocus, True)
End If
If ckQuickTime.CheckState = CheckState.Checked Then
Shell("quicktime.exe", AppWinStyle.NormalFocus, True)
End If
If ckVlc.CheckState = CheckState.Checked Then
Shell("vlc.exe", AppWinStyle.NormalFocus, True)
End If
End Sub

Link to comment
Share on other sites

Try this it should produce the messagebox if nothing is selected.

Private Sub cmdADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInstall.Click

'this is to see what check boxes are check, then install selected programs
If ckff.CheckState = CheckState.Checked Then
Shell("firefox.exe", AppWinStyle.NormalFocus, True)
ElseIf ckFlash.CheckState = CheckState.Checked Then
Shell("flash.exe", AppWinStyle.NormalFocus, True)
ElseIf ckQuickTime.CheckState = CheckState.Checked Then
Shell("quicktime.exe", AppWinStyle.NormalFocus, True)
ElseIf ckVlc.CheckState = CheckState.Checked Then
Shell("vlc.exe", AppWinStyle.NormalFocus, True)
Else
msgbox("Please Select A Item To Install",4128,"Select Item")
End If
End Sub

Link to comment
Share on other sites

Try this it should produce the messagebox if nothing is selected.
Private Sub cmdADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInstall.Click

'this is to see what check boxes are check, then install selected programs
If ckff.CheckState = CheckState.Checked Then
Shell("firefox.exe", AppWinStyle.NormalFocus, True)
ElseIf ckFlash.CheckState = CheckState.Checked Then
Shell("flash.exe", AppWinStyle.NormalFocus, True)
ElseIf ckQuickTime.CheckState = CheckState.Checked Then
Shell("quicktime.exe", AppWinStyle.NormalFocus, True)
ElseIf ckVlc.CheckState = CheckState.Checked Then
Shell("vlc.exe", AppWinStyle.NormalFocus, True)
Else
msgbox("Please Select A Item To Install",4128,"Select Item")
End If
End Sub

thanks for the help ^^

Link to comment
Share on other sites

well using the elseif doesn't work right, it doesn't lunch the next app once the one before it is done installing.

because in logic, elseif is an exclusive choice: either, or, not both.

You need to drop the elseif constructs and then run each in sequence. if checkbox is checked then run install ...

Use a flag var to check whether a box has been checked for your "nothing is checked" message box.

Link to comment
Share on other sites

well using the elseif doesn't work right, it doesn't lunch the next app once the one before it is done installing.

because in logic, elseif is an exclusive choice: either, or, not both.

You need to drop the elseif constructs and then run each in sequence. if checkbox is checked then run install ...

Use a flag var to check whether a box has been checked for your "nothing is checked" message box.

what would be the best way to do this.. ?

Link to comment
Share on other sites

what would be the best way to do this.. ?

As was described, there's nothing mystical about it. In fact, you had it earlier (mostly).

dim flag as integer

Private Sub cmdADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInstall.Click

'this is to see what check boxes are check, then install selected programs
flag = 0
If ckff.CheckState = CheckState.Checked Then
Shell("firefox.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If ckFlash.CheckState = CheckState.Checked Then
Shell("flash.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If ckQuickTime.CheckState = CheckState.Checked Then
Shell("quicktime.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If ckVlc.CheckState = CheckState.Checked Then
Shell("vlc.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If flag = 0 Then
msgbox("Please Select A Item To Install",4128,"Select Item")
End If
End Sub

Link to comment
Share on other sites

what would be the best way to do this.. ?

As was described, there's nothing mystical about it. In fact, you had it earlier (mostly).

dim flag as integer

Private Sub cmdADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInstall.Click

'this is to see what check boxes are check, then install selected programs
flag = 0
If ckff.CheckState = CheckState.Checked Then
Shell("firefox.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If ckFlash.CheckState = CheckState.Checked Then
Shell("flash.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If ckQuickTime.CheckState = CheckState.Checked Then
Shell("quicktime.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If ckVlc.CheckState = CheckState.Checked Then
Shell("vlc.exe", AppWinStyle.NormalFocus, True)
flag = 1
End If
If flag = 0 Then
msgbox("Please Select A Item To Install",4128,"Select Item")
End If
End Sub

ah, ok i see how you put the flags in... guess i couldn't just see it in my head, lol

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...