Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

I cant get my vb.net express app to start with System.Diagnostics.Process.Start("C:\WindowsApplication1 - 1 ")

Posted on 2009-05-19
12
Medium Priority
?
395 Views
Last Modified: 2012-05-07
I published a vb.net 2008 express application which I am now trying to run from a different vb.net application using
System.Diagnostics.Process.Start("C:\WindowsApplication1 - 1 ")
this is of courese a shortcut that I put in the c drive
any shortcut from any other program works just not my vb.net app shortcut what is wrong?
it keeps saying "The system cannot find the file specified"
0
Comment
Question by:Dov_B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
12 Comments
 
LVL 9

Assisted Solution

by:CyberLex
CyberLex earned 400 total points
ID: 24426001
System.Diagnostics.Process.Start("C:\WindowsApplication1 - 1 ")

the space after the 2nd 1 and " ? shortcuts dont support spaces at the end?

cheers
Lex
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24426317
Is -1 an argument ?
You can try:

System.Diagnostics.Process.Start("C:\Path to your WindowsApplication1", "-1")
0
 

Author Comment

by:Dov_B
ID: 24426493
I changed the shortcut to ("C:\Path to your WindowsApplication") it works when I double click it but still says it cannot find it when I try to open it through vb.net's
System.Diagnostics.Process.Start("C:\Path to your WindowsApplication")
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Expert Comment

by:jpaulino
ID: 24426573
Can you show all the path and how do you use that instruction ?
0
 

Author Comment

by:Dov_B
ID: 24426620

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        System.Diagnostics.Process.Start _
      ("c:\WindowsApplication")
 
    End Sub

Open in new window

0
 

Author Comment

by:Dov_B
ID: 24426627
oh by the way the file is a shortcut
0
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 1600 total points
ID: 24426668
If it's a shortcut and the shortcut is right for the application then should work. Why don't you call the exe file ? Have you checked the shortcut path ?
0
 

Author Comment

by:Dov_B
ID: 24426732
yes when I double click the shortcut directly the application starts up but when I try to use the shortcut through vb.net it says it cannot find it but what is wacky is that if I put in a shortcut for any other application they run through vb.net I only have problems with the shortcuts to vb.net apps that I published myself
0
 

Author Comment

by:Dov_B
ID: 24445442
Dear jpaulino
I cant call th exe files directly because I have no way of knowing where vb.net 2008 express is going to install them
however I created the shortcuts differently and now I dont get the error which says it cannot find the file
however it does not run the program simply nothing happens
please note that
System.Diagnostics.Process.Start("C:\Myvb.netshortcut")
does run the shortcuts of any non vb app on my system I only have problem with apps I have created myself
also note that the ("C:\Myvb.netshortcut") does run properly when you double click it with your mouse
0
 

Author Comment

by:Dov_B
ID: 24445894
the problem was I was using the shortcuts used on the start menu when I used code to create the shortcut it worked
0
 

Accepted Solution

by:
Dov_B earned 0 total points
ID: 24445910
this is the code I used to create the shortcut that worked
Private Function CreateShortCut(ByVal shortcutName As String, ByVal creationDir As String, ByVal targetFullpath As String, ByVal workingDir As String) ', ByVal iconFile As String, ByVal iconNumber As Integer) As Boolean
        Try
            If Not IO.Directory.Exists(creationDir) Then
                Dim retVal As DialogResult = MsgBox(creationDir & " does not exist. Do you wish to create it?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo)
                If retVal = DialogResult.Yes Then
                    IO.Directory.CreateDirectory(creationDir)
                Else
                    Return False
                End If
            End If
            Dim wshShell As New WshShellClass ' <--- ADD THIS LINE
            Dim shortCut As IWshRuntimeLibrary.IWshShortcut
            shortCut = CType(wshShell.CreateShortcut(creationDir & "\" & shortcutName & ".lnk"), IWshRuntimeLibrary.IWshShortcut)
            shortCut.TargetPath = targetFullpath
            shortCut.WindowStyle = 1
            shortCut.Description = shortcutName
            shortCut.WorkingDirectory = workingDir
            'shortCut.IconLocation = iconFile & ", " & iconNumber
            shortCut.Save()
            Return True
        Catch ex As System.Exception
            Return False
        End Try
    End Function

Open in new window

0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24446214
Sorry I was out :(
Glad you have solved your problem creating the shortcut in runtime. That was strange because I have created a test project and worked just fine. Nevermind ... it's running :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question