I want a button that will navigate to the My Document folder when pressed

I want to have Buttons in a VB Form navigating to places like,My Documents, Network Places, My Pictures etc.

Does anone know code for me to be able to do this...

Thanks



Answer this question

I want a button that will navigate to the My Document folder when pressed

  • DevDiver

    you shouldnt need to access the registry. You will have problems eventually such as security issues.  Nor should you need to create a batch file :-)

    Best thing to do is spin up a process of the MyDocuments using the Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

    the SpecialFolder enumerator gives you a list of standard user folders you can access. This would be the best way



  • Rach M

    When the button is pressed nothing happens and I want it to take me to the "my documents" folder..................

  • Drksrvnt

    And it promised to "take you to the folder" Could you please post help URL

  • Ed C

    to access the my documents folder, what you have there is fine but just change the enum value to "MyDocuments" instead of "System" and thats it.

  • JDPeckham

    Here is my exact code

    I am working in VB (VS2005) and WM5 pocketPC

    Imports System

    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Console.WriteLine()
    Console.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.Personal))

    End Sub
    End Class

    When I press the button nothing happens. I know I am doing something wrong. Also If I try using the work MyDocuments in place of Personal I get an error.

  • DeadDante

    duplicate post answered in the other one.

  • tonalt

    Why do you believe something is wrong It appears you forgot to describe what you expect this code to do and what it actually does.

    To get help faster, see this, items 7, 10, 12, and 17.



  • GazCoder

    Could you help me with the GetfolderPath code. IS the this the code I would need to accomplish what you are saying. I want to access the my document folder and the SD card.
    Example code from VS2005
    ' Sample for the Environment.GetFolderPath method
    Imports System
    
    Class Sample
      Public Shared Sub Main()
       Console.WriteLine()
       Console.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.System))
      End Sub 'Main
    End Class 'Sample
    '
    'This example produces the following results:
    '
    'GetFolderPath: C:\WINNT\System32
    '
    
    Could you please help and show me what I need to do!
     
    thanks, Jim

  • Pr09aN1g0d

    ok

    * you can make it create a batch file (ends with .bat) with a command text


    Dim filename1 As Object
    filename1 = 'save path' & 'filename'
    FileOpen(1, filename1, OpenMode.Output)
    Print(1, 'commandtext')
    FileClose(1)


    * heres the command to open documents :
    start "%userprofile%\My Documents"


    * then , make then program start it :
    System.Diagnostics.Process.Start(batch file path)


    * if you want to have it work with all windows languages, make ur program read data on registry values in this subkey :

    Hkey_current_user\software\Microsoft\Windows\CurrentVersion\explorer\shellfolders

    you will find loads of path for currentuser there



  • Zulbaric

    That code could not possibly do that. At best it would print out some stuff to console if you have it or do exactly nothing if you don't have console (which is the case on most Windows Mobile devices).

    Depending on what do you mean by “take you to the folder” you should use something else, e.g. launch a file explorer process via System.Diagnostics.Process class or open file dialog using System.Windows.Forms.SaveFileDialog/OpenFileDialog.

    Just out of curiosity: how you come to the conclusion Console.WriteLine would “take you to the folder” and not just write line to the console Is MSDN documentation confusing and suggests something like this



  • Michael Herman - Parallelspace

    I got the sample code from a VS2005 help search

  • Srdjan

    what error do you get

    thread moved to the correct forum



  • Asif Hameed

    I am trying to have a push button access "my documents" folder on the Pocket PC

    I am not sure whats wrong with the code

    can anyone please help

    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    'GetFolderPath: My Documents

    Console.WriteLine()
    Console.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.Personal))

    End Sub

    End Class

  • Stephan Smetsers

    Thanks
  • I want a button that will navigate to the My Document folder when pressed