MSFN Forum: VB install app - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

VB install app Rate Topic: -----

#1 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 08:43 AM

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!

This post has been edited by lingk: 20 February 2008 - 08:44 AM



#2 User is offline   gunsmokingman 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,991
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 20 February 2008 - 09:21 AM

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

#3 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 09:35 AM

View Postgunsmokingman, on Feb 20 2008, 10:21 AM, said:

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


#4 User is offline   gunsmokingman 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,991
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 20 February 2008 - 09:58 AM

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

Quote

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

Quote

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


#5 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 10:15 AM

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


#6 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 10:16 AM

View Postgunsmokingman, on Feb 20 2008, 10:58 AM, said:

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

Quote

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

Quote

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




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

#7 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 11:16 AM

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


#8 User is offline   gunsmokingman 

  • MSFN Addict
  • Group: Super Moderator
  • Posts: 1,991
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 20 February 2008 - 12:23 PM

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

Quote

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


#9 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 12:37 PM

View Postgunsmokingman, on Feb 20 2008, 01:23 PM, said:

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

Quote

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 ^^

#10 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 12:52 PM

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

This post has been edited by lingk: 20 February 2008 - 12:57 PM


#11 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,239
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 20 February 2008 - 02:10 PM

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

#12 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-April 07

Posted 20 February 2008 - 02:15 PM

View Postlingk, on Feb 20 2008, 12:52 PM, said:

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.

#13 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 02:50 PM

View PostGlenn9999, on Feb 20 2008, 04:15 PM, said:

View Postlingk, on Feb 20 2008, 12:52 PM, said:

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.. ?

#14 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-April 07

Posted 20 February 2008 - 03:06 PM

View Postlingk, on Feb 20 2008, 03:50 PM, said:

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


#15 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 20 February 2008 - 03:26 PM

View PostGlenn9999, on Feb 20 2008, 05:06 PM, said:

View Postlingk, on Feb 20 2008, 03:50 PM, said:

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

#16 User is offline   lingk 

  • Newbie
  • Group: Members
  • Posts: 46
  • Joined: 22-July 06

Posted 21 February 2008 - 09:27 AM

well I have the app working now with any bugs that i can tell, i'm sure when i have my friends play with it they will find one or 2.

thanks to everyone who helped.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy