Dynamically Assigned Variable Names

Results 1 to 2 of 2

Thread: Dynamically Assigned Variable Names

  1. #1
    Join Date
    Dec 1969

    Default Dynamically Assigned Variable Names

    Hi there.<BR><BR>Is there any way to dynamically assign a variable name. I&#039;m in a situation where an array would not be very efficient, and neither would defining all of the variable names by hand.<BR><BR>I&#039;m wanting to read in a &#039;preferences&#039; file for a web-app I&#039;m writing. I envisioned each line in the text file as having a specific syntax. Such as:<BR><BR>&#039;variableName&#039;=&#039;value&#0 39;<BR>(for example bgcolor=&#039;&FF0000&#039;)<BR><BR>I want to be able to parse each line of text in the file, and using whatever is to the left of the equal sign as the variable name, and whatever is to the right as its assigned value.<BR><BR>Is this possible?

  2. #2
    Join Date
    Dec 1969

    Default Why not just use a dictionaryy..

    .. object?<BR><BR>Then, you can load it up by adding the elements to it.<BR><BR>And, you can refer to them as:<BR>Response.Write oDict("BG")<BR><BR>It&#039;s how I&#039;m loading settings out of an XML file for easy access in a Vb program.

Posting Permissions

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