lingk Posted February 20, 2008 Share Posted February 20, 2008 (edited) 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 February 20, 2008 by lingk Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 20, 2008 Share Posted February 20, 2008 It would help if you posted the code, my powers of seeing other people code in my mind does not work to good. Link to comment Share on other sites More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 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 SubEnd Class Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 20, 2008 Share Posted February 20, 2008 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 itto be completed.Example VBSDim 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 IfSo it looks like from your code you are not passing ,1,True theseparamaters. Those mean normal window and wait for it to finish. I do not know if VB allows for those paramaters.Perhaps try thisShell("firefox.exe", 1,True) Link to comment Share on other sites More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 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 More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 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 itto be completed.Example VBSDim 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 IfSo it looks like from your code you are not passing ,1,True theseparamaters. Those mean normal window and wait for it to finish. I do not know if VB allows for those paramaters.Perhaps try thisShell("firefox.exe", 1,True)I'll try giving this a try and see what happens. Link to comment Share on other sites More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 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 workPrivate 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 More sharing options...
gunsmokingman Posted February 20, 2008 Share Posted February 20, 2008 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 More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 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 Subthanks for the help ^^ Link to comment Share on other sites More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 (edited) well using the elseif doesn't work right, it doesn't lunch the next app once the one before it is done installing. Edited February 20, 2008 by lingk Link to comment Share on other sites More sharing options...
IcemanND Posted February 20, 2008 Share Posted February 20, 2008 I wrote one many years ago that is here on the board you are welcome to use and abuse it to your hearts content.http://www.msfn.org/board/Dear-Gosh-Vbs-Gu...8809#entry68809 Link to comment Share on other sites More sharing options...
Glenn9999 Posted February 20, 2008 Share Posted February 20, 2008 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 More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 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 More sharing options...
Glenn9999 Posted February 20, 2008 Share Posted February 20, 2008 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 integerPrivate 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 More sharing options...
lingk Posted February 20, 2008 Author Share Posted February 20, 2008 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 integerPrivate 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 Subah, 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now