Results 1 to 3 of 3

Thread: Using App.Path

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2001
    Location
    Montreal, Quebec
    Posts
    400

    Resolved Using App.Path

    The following returns an error that a Constant expression is required. I don't understand why it doesn't work.

    Thanks
    VB Code:
    1. Public Const Error_Path = App.Path & "\MachineTenderPM10_error.log"
    Last edited by Stan; Nov 9th, 2004 at 03:50 PM.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263
    The point of a constant is that the value is declared at "compile time" - not at run time.

    APP.PATH is only available at RUN TIME.

    You cannot have a constant with APP.PATH. It needs to be a variable...

  3. #3
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349
    Yeah he's write. The reason why that is an error is because that data within your constant has a possibility of changing while your program is running, whether or not it is IDE mode or EXE. Numerical values and strings on the other hand are perfectly legal. The thing you cannot have as values in constants is variables and functions (like App.Path), since again there is a possibility that variable's/function's value can change while the program is running.

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