Results 1 to 5 of 5

Thread: [RESOLVED] Computer name string

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2009
    Posts
    33

    Resolved [RESOLVED] Computer name string

    ok, i have been trying to create a program that accesses files on other computers. I have used the line
    Code:
    My.Computer.FileSystem.CopyDirectory("C:\Documents and Settings\Bob\Local Settings\Temporary Internet Files", "d:\My Documents")
    The problem is that the name of the directory changes according to what computer the program is running on. (The Bob part). When i use the "My.Computer.Name" line to get the computer name, it gives me "***\Bob". So i can get the name of the computer, but it has characters at the front that annoy me and stuff up the program when i set "***\Bob" as part of the directory. I just need it to be "Bob". Is there anyway to manpulate the string to remove the first 4 characters, and leave the rest?

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Computer name string

    You needed to post that in VB.net forum instead.

    Anyway, to get special folder path you can use Environment class and wouldn't have to hardcode anything:
    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Debug.Print(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))
        Debug.Print(Environment.GetFolderPath(Environment.SpecialFolder.Desktop))
        Debug.Print(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache))
        Debug.Print(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData))
    End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2009
    Posts
    33

    Re: Computer name string

    Thanks, i understand that.
    But how do i use that as a directory? Do i set it as a variable?
    please explain.
    Thanks

  4. #4

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2009
    Posts
    33

    Re: [RESOLVED] Computer name string

    Thanks heaps

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