Jump to content

  •  

  • iBotModz CBox


    Photo

    [help] Visual Basic 2008 Start Process Issue


    • Please log in to reply
    9 replies to this topic

    #1 Miles LLC

    Miles LLC

      Private Grade 2

    • Members+

    • 56 posts
    • Joined: 06-June 08
    • Gender:Male
    • Location:Missouri

    Posted 04 March 2010 - 08:55 PM

    SOLVED
    Thanks to, Peaches & dennijr

    This is the code that worked for me:
    Process.Start(Application.StartupPath & "\apps\test.txt")

    ----------------------------------------------------------------------------------------------------

    I'm making a program that is basicly a AIO. I have a code where it open's the program i want, ete.
    I'm using this code:
    System.Diagnostics.Process.Start("test.txt")

    But i don't want the program\files to be in the same folder as the .exe


    I want it like this, and when i do this i get a ERROR
    System.Diagnostics.Process.Start("apps\test.txt")


    Here is what i want it to be/work like:
    Posted Image



    ****
    So, my question is; how do i fix this?

    Edited by i7m, 05 March 2010 - 03:11 PM.


    #2 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 04 March 2010 - 09:43 PM

    When you start the file just by using test.txt it uses the current directory automatically. So now when you add apps its looking in C:apps\test.txt

    Instead use

    Application.StartupPath & "\\apps\\" & "test.txt" ;


    #3 theron324

    theron324

      Private

    • Members+

    • 40 posts
    • Joined: 25-July 08

    Posted 04 March 2010 - 09:55 PM

    are you trying to make it so u can click a button on the prgram and it opens a file/program?

    #4 Miles LLC

    Miles LLC

      Private Grade 2

    • Members+

    • 56 posts
    • Joined: 06-June 08
    • Gender:Male
    • Location:Missouri

    Posted 04 March 2010 - 10:10 PM

    When you start the file just by using test.txt it uses the current directory automatically. So now when you add apps its looking in C:apps\test.txt

    Instead use

    Application.StartupPath & "\\apps\\" & "test.txt" ;


    I just tryed that, and know i have that blue zig-zag line under the text.
    And i can't publish (errorzzz)





    are you trying to make it so u can click a button on the prgram and it opens a file/program?



    Yes.

    Edited by i7m, 04 March 2010 - 10:14 PM.


    #5 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 04 March 2010 - 10:17 PM

    no error with this :)

    Dim coolString As String = Application.StartupPath & "apps" & "test.txt"

    so

    
    System.Diagnostics.Process.Start(Application.StartupPath & "apps" & "test.txt")


    #6 dennijr

    dennijr

      Apprentice Grade 1

    • Members+

    • 7 posts
    • Joined: 16-February 10

    Posted 04 March 2010 - 10:22 PM

    try this:

    Process.Start(Application.StartupPath & "\apps\test.txt")

    that should do it


    hmm, peaches posted while i was playin around with it

    and is there a reason why your all using System.Diagnostics.Process.Start when Process.Start works fine on its own?


    Application.StartupPath & "\\apps\\" & "test.txt" ;
    hehe, this looks like c++ or c#, going by the escape characters and the semi-colon :p

    Edited by dennijr, 04 March 2010 - 10:35 PM.


    #7 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 05 March 2010 - 05:48 AM

    I remember little to no VB. All I remember is instead of + there is a &, I was so confused. So I opened up VB and just typed it in.

    #8 dennijr

    dennijr

      Apprentice Grade 1

    • Members+

    • 7 posts
    • Joined: 16-February 10

    Posted 05 March 2010 - 11:14 AM

    I remember little to no VB. All I remember is instead of + there is a &, I was so confused. So I opened up VB and just typed it in.

    haha, i know what you mean, when u try to use a language u havent used in a while, its not easy :p

    #9 Miles LLC

    Miles LLC

      Private Grade 2

    • Members+

    • 56 posts
    • Joined: 06-June 08
    • Gender:Male
    • Location:Missouri

    Posted 05 March 2010 - 03:09 PM

    try this:

    Process.Start(Application.StartupPath & "\apps\test.txt")



    Your's work perfectly.

    lol, peaches for some reason both of your's didn't work. Thanks Though

    #10 iBotPeaches

    iBotPeaches

      General Grade 6

    • Owner

    • 6,570 posts
    • Joined: 29-July 07
    • Gender:Male
    • Location:Kansas

    Posted 05 March 2010 - 05:55 PM

    I think its cause I forgot a backslash that I just noticed.