dcsimg
Results 1 to 3 of 3

Thread: Problems converting a constant

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Problems converting a constant

    I have a vbs file which contains a huge list of constants e.g

    Private Const Client = 3

    The problem I am having is that I need to change one of these constants into a variable populated by a function call. e.g

    Private Const Client = MyFunction()

    Naturally this will not work as it is a constant but I cant declare it as :

    Dim Client
    Client = MyFunction()


    because on a million pages which include this file and refer to this variable they will find that Client = nothing.

    Why cant I do this :

    Dim Client = MyFunction()

    There is no option explicit on my page although maybe the many pages including this file may have it on which I cannot change.
    Any ideas how I can get around this?
    Last edited by venerable bede; Sep 29th, 2016 at 10:15 AM.

    Parksie

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,324

    Re: Problems converting a constant

    Remove the constant/variable, and rename the function to Client (or create another function called Client which calls the existing function).

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Resolved Re: Problems converting a constant

    Thanks for that Si.
    Jesus, it is so obvious but couldn't see the wood for the tree I'm afraid.
    Thanks again.

    Parksie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width