MSFN Forum: help with vb (noobie) - MSFN Forum

Jump to content



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

help with vb (noobie) Rate Topic: -----

#1 User is offline   De Reszke 

  • errrrrrrr, I dunno!
  • Group: Members
  • Posts: 27
  • Joined: 01-January 04

Posted 16 January 2004 - 06:06 PM

hi, wondering if anybody can help me please

I am completly new to vb6, so any help would be much apprecciated

basically I have wrote several vbscripts that do various things, and i wanted to create a user interface with vb6, just simple command buttons that run the selected script

can somebody help me please?


#2 User is offline   De Reszke 

  • errrrrrrr, I dunno!
  • Group: Members
  • Posts: 27
  • Joined: 01-January 04

Posted 16 January 2004 - 08:10 PM

I currently have:


Private Sub start_Click()
shell ("c:\program files\cv1.vbs")
End Sub


but no luck :)

#3 User is offline   Datalore 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 852
  • Joined: 05-October 03

Posted 16 January 2004 - 09:22 PM

Try this:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const conSwNormal = 1

Private Sub start_Click()
ShellExecute hWnd, "open", "C:\Program Files\cv1.vbs", vbNullString, vbNullString, conSwNormal
End Sub

That should work. If for some weird reason it doesn't, mess around with this:
Shell ("start C:\Program Files\cv1.vbs")
I don't know if the inclusion of the word "start" or "run" makes a difference.

#4 User is offline   De Reszke 

  • errrrrrrr, I dunno!
  • Group: Members
  • Posts: 27
  • Joined: 01-January 04

Posted 17 January 2004 - 08:48 AM

Thankyou very very much, much appreciated

It worked a treat!!! :)

#5 User is offline   brian 

  • Junior
  • Pip
  • Group: Members
  • Posts: 51
  • Joined: 17-December 03

Posted 23 January 2004 - 02:35 PM

The easiest way I found is

Shell "explorer c:\program files\cv1.vbs"

#6 User is offline   Tarun 

  • Area 5 Investigator
  • Group: Super Moderator
  • Posts: 2,991
  • Joined: 27-January 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 28 January 2004 - 09:00 PM

A snippet of code that checks for the file you're about to launch. It's helpful in those sort of apps, especially if you deploy to end users.

Public Function FileExists(testFile As String) As Boolean
On Error GoTo noExist
    Dim fn As Long
    fn = FreeFile
    Open testFile For Input As #fn
    Close #fn
    FileExists = True
    Exit Function
noExist: FileExists = False
End Function


Now for your button pressing. (Btw. Give items useful three letter prefixes. Command buttons get cmd etc, List boxes get lst, etc etc.)

Dim Path as String
Private Sub cmdCv1_Click()
    Path = LCase$("C:\PROGRAM FILES\CV1.VBS")
    If FileExists(Path) = True Then
        Call Shell(Path)
    Else
        MsgBox "cv1.vbs was not found." & vbCrLf & "Loading aborted.", vbCritical, "Unable to load cv1.vbs."
    End If
End Sub


#7 User is offline   XtremeMaC 

  • MSFN SuperB
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5,070
  • Joined: 13-October 03

Posted 28 January 2004 - 09:22 PM

ok www.experts-exchange.com
should help u a lot.. if not this board..

#8 User is offline   De Reszke 

  • errrrrrrr, I dunno!
  • Group: Members
  • Posts: 27
  • Joined: 01-January 04

Posted 01 February 2004 - 08:27 PM

Thanks very much you guys, you have all been very helpfull


I have now sorted it! :)

#9 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 02 February 2004 - 03:46 AM

best place to start with n00bie coding is buy a book, specifically on visual basic.. (6 or .Net) what ever u have.. or library, or many places on the net.. www.pscode.com for samples. snippets or tutorials..

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