1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: New to Visual Studio

Discussion in 'Software Development' started by Dreambringer, Oct 13, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Dreambringer

    Dreambringer Thread Starter

    Joined:
    Jan 19, 2005
    Messages:
    1,351
    So I decided to give Visual Studio a whirl and so far have loved it. I have started to work on small applications that will make my day to day tasks run much smoother.

    I do have a small questions...

    I have an application that I would like to run with a button, I understand I will use:

    Code:
    System.Diagnostics.Process.Start("C:\Documents and Settings\Vision\Application Data\blah.exe")
    
    to run the application. So my questions is, how can I use %profile% instead of the user name.

    I have tried to use the "GetUserName" to no avail.

    Any help or suggestions?

    Thank you in advance!
     
  2. peterh40

    peterh40

    Joined:
    Apr 15, 2007
    Messages:
    1,414
    First Name:
    Peter
    Try the Environ() function to get values of environmental variables incuding Profile, ComputerName, UserName, HomePath and so on.
     
  3. Dreambringer

    Dreambringer Thread Starter

    Joined:
    Jan 19, 2005
    Messages:
    1,351
    Duh... I knew that... not sure why I was using GetUserName...

    Thank you, so now onto to the second part. How would I go about using the "%profile%" rather then the actual profile name in the link to the application?
     
  4. Dreambringer

    Dreambringer Thread Starter

    Joined:
    Jan 19, 2005
    Messages:
    1,351
    Got it.. thanks for the heads up...

    Code:
            Dim UserName As String
            UserName = (Environ("UserName"))
            System.Diagnostics.Process.Start("C:\Documents and Settings\" & UserName & "\Application Data\blah.exe")
    
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/758869

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice