Results 1 to 25 of 25

Thread: How To Lunch exe program from vb project in any PC

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    How To Lunch exe program from vb project in any PC

    Hello Guys i want to make Project filled with exe files can any one use it in any pc iam using vb2010 Express
    Any Solution?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,691

    Re: How To Lunch exe program from vb project in any PC

    I think you need to provide a more detailed explanation of what you're trying to
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,691

    Re: How To Lunch exe program from vb project in any PC

    If all you're asking is how to run a program from code then the answer is to call Process.Start.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by jmcilhinney View Post
    I think you need to provide a more detailed explanation of what you're trying to
    Look! i need to make program which has a collection for programs exe if the user click in a button the program Open in any pc

    i try this code BUt it open in my pc only if i used in any pc Error Appear

    HTML Code:
    Process.Start("C:\path_to\myapp.exe")
    Like that program when i click on the Run Beethink Setup Program Appear and the folder of program have the setup exe file

    Name:  lol.jpg
Views: 1133
Size:  29.9 KB

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,691

    Re: How To Lunch exe program from vb project in any PC

    I think you need to use a bit of common sense here. That code is going to work on any machine as long as the app you specify to run exists. If it doesn't exist then obviously it can't run. Unless you can provide some meaningful information about the error that suggests otherwise, I can only assume that the program you're specifying doesn't exist.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by jmcilhinney View Post
    I think you need to use a bit of common sense here. That code is going to work on any machine as long as the app you specify to run exists. If it doesn't exist then obviously it can't run. Unless you can provide some meaningful information about the error that suggests otherwise, I can only assume that the program you're specifying doesn't exist.
    Bro How this code will Work if the Onther user dont have the Path file on his Pc

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,691

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Bro How this code will Work if the Onther user dont have the Path file on his Pc
    It won't, and why would you expect it to? You can't magically run software on a computer that isn't there. If you want to run a program then the program has to actually be there. It's that simple.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by jmcilhinney View Post
    It won't, and why would you expect it to? You can't magically run software on a computer that isn't there. If you want to run a program then the program has to actually be there. It's that simple.
    Yep i will Upload the Program Files with my app.exe Folder so from the program in just click the program open so Now The Above Code will Work ? if work How i can Use it ?

  9. #9
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,671

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Hello Guys i want to make Project filled with exe files can any one use it in any pc iam using vb2010 Express
    Any Solution?
    Quote Originally Posted by AbdelazizOmar View Post
    Look! i need to make program which has a collection for programs exe if the user click in a button the program Open in any pc

    i try this code BUt it open in my pc only if i used in any pc Error Appear

    HTML Code:
    Process.Start("C:\path_to\myapp.exe")
    Like that program when i click on the Run Beethink Setup Program Appear and the folder of program have the setup exe file

    Name:  lol.jpg
Views: 1133
Size:  29.9 KB
    Quote Originally Posted by AbdelazizOmar View Post
    Bro How this code will Work if the Onther user dont have the Path file on his Pc
    I'm going to take all of these statements together, apply some assumptions, mix in a blender and see if I can come out with the more correct solution...

    It sounds like you want to package multiple pre-existing apps into your app, then have your application extract them and run them when the user clicks a button. That's what installers are for. I don't recommend writing your own, because there are parts of the system it needs to write to (potentially) that Windows isn't going to let you have access to (but a properly registered installer would).

    Also, a lot of viruses work this way... by packaging themselves inside another app... so it's possible that your app could get flagged as a potential threat.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  10. #10
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: How To Lunch exe program from vb project in any PC

    I think he means he has a program and there will be other exe files in the deployed folder that his app will want to be able to run, if so then Application.StartupPath is what he's looking for when calling any of those other exe files.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  11. #11

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by JuggaloBrotha View Post
    I think he means he has a program and there will be other exe files in the deployed folder that his app will want to be able to run, if so then Application.StartupPath is what he's looking for when calling any of those other exe files.
    Yep JuggaloBrotha You Know my request

  12. #12

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Any Useful Answer? i Have A Program and i want to Fill it With a Programs Any User in any Pc Can Open The Program from My Program i have made it Like That Video !>>> https://youtu.be/e7TAX7JxefI

  13. #13
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Any Useful Answer? i Have A Program and i want to Fill it With a Programs Any User in any Pc Can Open The Program from My Program i have made it Like That Video !>>> https://youtu.be/e7TAX7JxefI
    I thought we already answered this, you have the exe files in the same folder as your app's exe file (I'm assuming an installer will guarantee that), then when the user selects (or does whatever to run) one of the programs you combine the Application.StartupPath with the exe file and and pass it to a Process.Start() to run it.
    You can even use Directory.GetFiles() with Application.StartupPath to get the list of files as needed too.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  14. #14

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by JuggaloBrotha View Post
    I thought we already answered this, you have the exe files in the same folder as your app's exe file (I'm assuming an installer will guarantee that), then when the user selects (or does whatever to run) one of the programs you combine the Application.StartupPath with the exe file and and pass it to a Process.Start() to run it.
    You can even use Directory.GetFiles() with Application.StartupPath to get the list of files as needed too.
    Bro iam Beginner! Can You Explain To me by Steps Or Photo ?

  15. #15
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,691

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Bro iam Beginner! Can You Explain To me by Steps Or Photo ?
    You're a beginner, not a vegetable. You've been told exactly what to do so now is where you make an effort to do it. Don't just assume that you can't and expect others to do for you. If you have an issue, then you can post what you've tried and we can tell you how to correct it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  16. #16

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by jmcilhinney View Post
    You're a beginner, not a vegetable. You've been told exactly what to do so now is where you make an effort to do it. Don't just assume that you can't and expect others to do for you. If you have an issue, then you can post what you've tried and we can tell you how to correct it.
    Bro How can i get Directory.GetFiles() with Application.StartupPath ?? Which code can i use which steps can i do ?

  17. #17
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Bro How can i get Directory.GetFiles() with Application.StartupPath ?? Which code can i use which steps can i do ?
    Directory.GetFiles Method (String) (System.IO)
    Application.StartupPath Property (System.Windows.Forms)

    If that's too advanced for you, I'd suggest learning up on vb.net and programming in general: VB.Net Tutorial
    Last edited by JuggaloBrotha; Dec 17th, 2015 at 02:56 PM.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  18. #18
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,691

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Bro How can i get Directory.GetFiles() with Application.StartupPath ?? Which code can i use which steps can i do ?
    Bro, did you put any thought into it? What does Directory.GetFiles do? Have you made any effort to find out? It takes a folder path and returns an array of file paths for the files in that folder. What does Application.StartupPath do? Have you made any effort to find out? It returns a folder path. Can you put 2 and 2 together? If you sit there and expect the information to come to you then you should not be surprised when you get no information.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  19. #19

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by jmcilhinney View Post
    Bro, did you put any thought into it? What does Directory.GetFiles do? Have you made any effort to find out? It takes a folder path and returns an array of file paths for the files in that folder. What does Application.StartupPath do? Have you made any effort to find out? It returns a folder path. Can you put 2 and 2 together? If you sit there and expect the information to come to you then you should not be surprised when you get no information.
    i DOn't know information! BUt i post thread here to get help how can i do it all told me Do that : Directory.GetFiles() with Application.StartupPath ??

    But How? Are Directory.getfiles that i should upload the files to it or what? there any video or pdf website explain that ?

  20. #20
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by jmcilhinney View Post
    Bro, did you put any thought into it? What does Directory.GetFiles do? Have you made any effort to find out? It takes a folder path and returns an array of file paths for the files in that folder. What does Application.StartupPath do? Have you made any effort to find out? It returns a folder path. Can you put 2 and 2 together? If you sit there and expect the information to come to you then you should not be surprised when you get no information.
    Quote Originally Posted by AbdelazizOmar View Post
    i DOn't know information! BUt i post thread here to get help how can i do it all told me Do that : Directory.GetFiles() with Application.StartupPath ??

    But How? Are Directory.getfiles that i should upload the files to it or what? there any video or pdf website explain that ?
    Guys, I've already linked him to the documentation that explain exactly (even has code examples) for each of the things mentioned:
    Quote Originally Posted by JuggaloBrotha View Post
    Directory.GetFiles Method (String) (System.IO)
    Application.StartupPath Property (System.Windows.Forms)

    If that's too advanced for you, I'd suggest learning up on vb.net and programming in general: VB.Net Tutorial
    It's up to him to show some effort now.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  21. #21

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by JuggaloBrotha View Post
    Guys, I've already linked him to the documentation that explain exactly (even has code examples) for each of the things mentioned:It's up to him to show some effort now.
    Ok Bro i have Onther idea to make ....... i want the User slecet the file from button and the path file appear in text then he click in Open file the program OPen and button to save changes like that photo Which Codes can i Use Name:  yarab tanf3.PNG
Views: 824
Size:  7.5 KB
    For File path= ! ?
    For Open File- ! ?
    For Save Changes = !? when he open the program again he will find the program selected so when click in open the program open .
    Last edited by AbdelazizOmar; Dec 18th, 2015 at 04:36 PM.

  22. #22
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Ok Bro i have Onther idea to make ....... i want the User slecet the file from button and the path file appear in text then he click in Open file the program OPen and button to save changes like that photo Which Codes can i Use Name:  yarab tanf3.PNG
Views: 824
Size:  7.5 KB
    For File path= ! ?
    For Open File- ! ?
    For Save Changes = !? when he open the program again he will find the program selected so when click in open the program open .
    You can use an OpenFileDialog for getting the file (program) to run.

    Then in the other button you can use Process.Start() to run it.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  23. #23

    Thread Starter
    Member
    Join Date
    Dec 2015
    Posts
    54

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by JuggaloBrotha View Post
    You can use an OpenFileDialog for getting the file (program) to run.

    Then in the other button you can use Process.Start() to run it.
    Bro now i have Code for Browisng file
    Code:
     Dim dialog As New OpenFileDialog()
            If DialogResult.OK = dialog.ShowDialog Then
                TextBox1.Text = dialog.FileName
            End If
    Now i need Code for Button2 ( OPen file path you Selected) which the file that user select from Button1 To Make Program Open...... Which Code can i use can you Direct and give me the code
    Last edited by AbdelazizOmar; Dec 18th, 2015 at 05:13 PM.

  24. #24
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: How To Lunch exe program from vb project in any PC

    Process.Start(TextBox1.Text)
    Process.Start(Application.StartupPath & "\MyApp.exe")

  25. #25
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: How To Lunch exe program from vb project in any PC

    Quote Originally Posted by AbdelazizOmar View Post
    Bro now i have Code for Browisng file
    Code:
     Dim dialog As New OpenFileDialog()
            If DialogResult.OK = dialog.ShowDialog Then
                TextBox1.Text = dialog.FileName
            End If
    Now i need Code for Button2 ( OPen file path you Selected) which the file that user select from Button1 To Make Program Open...... Which Code can i use can you Direct and give me the code
    *le sigh*
    vb.net Code:
    1. Imports System.IO
    2.  
    3. Public Class Form1
    4.  
    5.     Private m_Process As Process
    6.  
    7.     Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    8.         TextBox1.ReadOnly = True
    9.     End Sub
    10.  
    11.     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    12.         Dim ProgramFileName As String = Path.GetFileName(Application.ExecutablePath).ToLower
    13.         Using ofd As New OpenFileDialog With {.InitialDirectory = Application.StartupPath, .Title = "Select a program to run", .DefaultExt = "exe", .Filter = "Exe Files|*.exe", .AddExtension = True}
    14.             If ofd.ShowDialog(Me) <> DialogResult.Cancel AndAlso Not ofd.FileName.ToLower.EndsWith(ProgramFileName) Then TextBox1.Text = ofd.FileName
    15.         End Using
    16.     End Sub
    17.  
    18.     Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    19.         m_Process = Process.Start(TextBox1.Text)
    20.     End Sub
    21.  
    22. End Class
    That's only for using an OpenFileDialog, like was discussed before, you can load those program's file names into something like a ComboBox that way the available options are given to them and you simply grab the file name selected and append the Applicatio.StartupPath and run it.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

Tags for this Thread

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