HighTechTalks DotNet Forums  

Linking to an executable VS 2008

Dotnet General Discussions microsoft.public.dotnet.general


Discuss Linking to an executable VS 2008 in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
SDS2
 
Posts: n/a

Default Linking to an executable VS 2008 - 05-09-2010 , 10:38 AM






Hey,

I was wondering if i could create a program in Visual Studio 2008 with a
link to an executable of an application (like MS WORD) in it.

By pressing a button, the executable of the application should start.

I can't manage to find out the right code to do so.


Can anyone help me out?



Thanks in advance.

Stan

Reply With Quote
  #2  
Old   
Family Tree Mike
 
Posts: n/a

Default Re: Linking to an executable VS 2008 - 05-09-2010 , 10:55 AM






On 5/9/2010 11:38 AM, SDS2 wrote:
Quote:
Hey,

I was wondering if i could create a program in Visual Studio 2008 with a
link to an executable of an application (like MS WORD) in it.

By pressing a button, the executable of the application should start.

I can't manage to find out the right code to do so.


Can anyone help me out?



Thanks in advance.

Stan

Look at System.Diagnostics.Process.Start("some path to an exe");

--
Mike

Reply With Quote
  #3  
Old   
Patrick A
 
Posts: n/a

Default Re: Linking to an executable VS 2008 - 05-10-2010 , 05:24 PM



Stan,

Do you want to open a file while you're at it?

Here's what I'm doing...not sure it's the best method.

Imports Microsoft.Office.Interop

Private Sub ReportsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ReportsToolStripMenuItem.Click
Dim MyAccess As Access.Application
MyAccess = GetObject("P:\Production Resources\Legal55\Reports
\Timekeeper Reports.mdb", "Access.Application")
MyAccess.Visible = True
End Sub

Patrick

Reply With Quote
  #4  
Old   
Family Tree Mike
 
Posts: n/a

Default Re: Linking to an executable VS 2008 - 05-10-2010 , 05:47 PM



On 5/10/2010 6:24 PM, Patrick A wrote:
Quote:
Stan,

Do you want to open a file while you're at it?

Here's what I'm doing...not sure it's the best method.

Imports Microsoft.Office.Interop

Private Sub ReportsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ReportsToolStripMenuItem.Click
Dim MyAccess As Access.Application
MyAccess = GetObject("P:\Production Resources\Legal55\Reports
\Timekeeper Reports.mdb", "Access.Application")
MyAccess.Visible = True
End Sub

Patrick
If you just want to launch access (or word) with a given file, then you
should use:

dim p as new Process()
p.StartInfo.FileName = "somefilename.mdb" ' or "somefilename.doc"
p.StartInfo.Verb = "Open"
p.Start()

--
Mike

Reply With Quote
  #5  
Old   
SDS2
 
Posts: n/a

Default Re: Linking to an executable VS 2008 - 05-11-2010 , 01:54 PM



Isn't there a method that is able to open any path? (an application?)


"Family Tree Mike" <FamilyTreeMike (AT) ThisOldHouse (DOT) com> schreef in bericht
news:uBgZ3KJ8KHA.3880 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
Quote:
On 5/10/2010 6:24 PM, Patrick A wrote:
Stan,

Do you want to open a file while you're at it?

Here's what I'm doing...not sure it's the best method.

Imports Microsoft.Office.Interop

Private Sub ReportsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ReportsToolStripMenuItem.Click
Dim MyAccess As Access.Application
MyAccess = GetObject("P:\Production Resources\Legal55\Reports
\Timekeeper Reports.mdb", "Access.Application")
MyAccess.Visible = True
End Sub

Patrick

If you just want to launch access (or word) with a given file, then you
should use:

dim p as new Process()
p.StartInfo.FileName = "somefilename.mdb" ' or "somefilename.doc"
p.StartInfo.Verb = "Open"
p.Start()

--
Mike

Reply With Quote
  #6  
Old   
SDS2
 
Posts: n/a

Default Re: Linking to an executable VS 2008 - 05-11-2010 , 02:00 PM



The System.Diagnostics.Process.Start
works perfectly!

Thanks a lot!


"SDS2" <nomailtoSDS (AT) collegewaregemdeletethis (DOT) com> schreef in bericht
news:eavtktT8KHA.1316 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Quote:
Isn't there a method that is able to open any path? (an application?)


"Family Tree Mike" <FamilyTreeMike (AT) ThisOldHouse (DOT) com> schreef in bericht
news:uBgZ3KJ8KHA.3880 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
On 5/10/2010 6:24 PM, Patrick A wrote:
Stan,

Do you want to open a file while you're at it?

Here's what I'm doing...not sure it's the best method.

Imports Microsoft.Office.Interop

Private Sub ReportsToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ReportsToolStripMenuItem.Click
Dim MyAccess As Access.Application
MyAccess = GetObject("P:\Production Resources\Legal55\Reports
\Timekeeper Reports.mdb", "Access.Application")
MyAccess.Visible = True
End Sub

Patrick

If you just want to launch access (or word) with a given file, then you
should use:

dim p as new Process()
p.StartInfo.FileName = "somefilename.mdb" ' or "somefilename.doc"
p.StartInfo.Verb = "Open"
p.Start()

--
Mike

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.