CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Mar 2011
    Posts
    153

    [RESOLVED] Can't launch particular program on button click

    I hope I'm in the right place, lol. I am trying to activate Rosetta Stone on a button click (button4). It opens but gives me an error. 2123 is the error code. I guess this may require knowledge of Rosetta Stone more than VB but I have found no luck searching google. Is there alternative code to what I'm trying to do?

    Code:
    Public Class Form1
    
        Private Sub Chrome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chrome.Click
            System.Diagnostics.Process.Start("chrome.exe")
        End Sub
    
        Private Sub CCleaner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CCleaner.Click
            System.Diagnostics.Process.Start("ccleaner.exe")
        End Sub
    
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rappelz.Click
            System.Diagnostics.Process.Start("C:\gPotato\Rappelz\Launcher.exe")
        End Sub
    
        Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
            System.Diagnostics.Process.Start("C:\Program Files\Rosetta Stone\Rosetta Stone Version 3\RosettaStoneVersion3.exe")
        End Sub
    
        Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
            System.Diagnostics.Process.Start("taskmgr.exe")
        End Sub
    
        Private Sub Calc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calc.Click
            System.Diagnostics.Process.Start("calc.exe")
        End Sub
    End Class

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Can't launch particular program on button click

    Look at the properties of the button, to see what the parameters are
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Can't launch particular program on button click

    [ Moved ]

  4. #4
    Join Date
    Mar 2011
    Posts
    153

    Re: Can't launch particular program on button click

    Okay, sorry it took so long to respond. What am I supposed to be looking at?

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Can't launch particular program on button click

    Right-click on the start menu item, and examine the properties for %1 or something at the end.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Mar 2011
    Posts
    153

    Re: Can't launch particular program on button click

    Do you mean outside of VB? If so, I looked at both and I do not see a 1% or any % sign anywhere

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Can't launch particular program on button click

    Might not have permission to see that folder. Post the exact path
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Mar 2011
    Posts
    153

    Re: Can't launch particular program on button click

    Quote Originally Posted by dglienna View Post
    Might not have permission to see that folder. Post the exact path
    Here on the forum or in the program? I already did in the program.

    In case you mean here,
    C:\Program Files\Rosetta Stone\Rosetta Stone Version 3\RosettaStoneVersion3.exe

    I'm assuming you mean in the program so I feel kinda dumb posting that

  9. #9
    Join Date
    Mar 2011
    Posts
    10

    Re: Can't launch particular program on button click

    Try to use "shell:

    Private Sub Chrome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chrome.Click

    shell ("chrome.exe")

    End Sub

    Private Sub Calc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calc.Click
    shell ("calc.exe")
    End Sub

  10. #10
    Join Date
    Mar 2011
    Posts
    153

    Re: Can't launch particular program on button click

    I already tried that. The same thing happens

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Can't launch particular program on button click

    Well, there has to be some command-line switch. CD to the folder and find the name of the .exe

    then, execute the command
    Code:
    myProgramName.exe /?
    To see if there are command-line options.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    Mar 2011
    Posts
    153

    Re: Can't launch particular program on button click

    Oh wow I forgot about this thread. oops... I remembered because I have the same problem again.

    dglienna, That may have worked but I have changed how the program works. The user selects the file using "openfiledialog.showdialog()"

  13. #13
    Join Date
    Oct 2010
    Posts
    23

    Re: Can't launch particular program on button click

    Try setting the working directory before launching otherwise it will default to system:
    Sometimes, certain applications- have problems when running without a specified working directory.

    Code:
    dim process as new process()
    process.StartInfo.UseShellExecute = False
    process.StartInfo.FileName="C:\Program Files\Rosetta Stone\Rosetta Stone Version 3\RosettaStoneVersion3.exe"
    process.StartInfo.workingdirectory=io.path.getdirectoryname("C:\Program Files\Rosetta Stone\Rosetta Stone Version 3\RosettaStoneVersion3.exe")
    process.start
    Last edited by StriderH2; April 6th, 2011 at 02:55 PM.

  14. #14
    Join Date
    Mar 2011
    Posts
    153

    Re: Can't launch particular program on button click

    I'm getting, "Reference to a non-shared members requires an object reference".

  15. #15
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Can't launch particular program on button click

    on which line do get this error?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured