Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. 2 Simple Questions

2 Simple Questions

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arunforce
    wrote on last edited by
    #1

    I got 2 quick questions: 1> System.Diagnostics.Process.Start("Explorer.exe", "%USERPROFILE%\My Documents\") returns folder doesn't exist because I have my documents in there, but I need to goto my documents, what should I do? 2> How do you set a global variable in .net that is accessable across multiple forms. Like Dim blah as Global? Thanks...

    C 1 Reply Last reply
    0
    • A arunforce

      I got 2 quick questions: 1> System.Diagnostics.Process.Start("Explorer.exe", "%USERPROFILE%\My Documents\") returns folder doesn't exist because I have my documents in there, but I need to goto my documents, what should I do? 2> How do you set a global variable in .net that is accessable across multiple forms. Like Dim blah as Global? Thanks...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      arunforce wrote:

      %USERPROFILE%

      You can't do this, you need to look up the path and pass the full path in.

      arunforce wrote:

      How do you set a global variable in .net that is accessable across multiple forms. Like Dim blah as Global?

      The only way is to have a class that holds it, and make it public and static.  Consider making it a property, at least, and consider overall if it REALLY needs to be public.  If you need to share stuff between two forms, a delegate is a better way to do it.

      Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

      A 1 Reply Last reply
      0
      • C Christian Graus

        arunforce wrote:

        %USERPROFILE%

        You can't do this, you need to look up the path and pass the full path in.

        arunforce wrote:

        How do you set a global variable in .net that is accessable across multiple forms. Like Dim blah as Global?

        The only way is to have a class that holds it, and make it public and static.  Consider making it a property, at least, and consider overall if it REALLY needs to be public.  If you need to share stuff between two forms, a delegate is a better way to do it.

        Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

        A Offline
        A Offline
        arunforce
        wrote on last edited by
        #3

        Then how do people do things such as that, with programs? It opens their my documents, I can do %userprofile% fine, I just can't attach my documents to the end. I don't think you know much about that. And, how would I go about doing a class in VB.NET?

        C 1 Reply Last reply
        0
        • A arunforce

          Then how do people do things such as that, with programs? It opens their my documents, I can do %userprofile% fine, I just can't attach my documents to the end. I don't think you know much about that. And, how would I go about doing a class in VB.NET?

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          The Environment.SpecialFolder enum allows you to ask for the path to folders such as the userprofile.

          arunforce wrote:

          And, how would I go about doing a class in VB.NET?

          There is no way to write code in VB.NET outside of a class. Do you know what a class is ? If not, you need to take a step back and learn some basics.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups