Results 1 to 6 of 6

Thread: Const Question

  1. #1
    Guest
    Hi all
    i want to have some string constant
    i put these in a module
    public const name(1) ="hi"
    public const name(2) = "hi2"
    it says i can not have array , so, what can i do?

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Thumbs up Use different names for each constant

    You can use different names for each constant like this:
    Code:
        Public Const HELLO As String = "Hello"
        Public Const HELLO_2 As String = "Hello Again"
    ~seaweed

  3. #3
    Guest

    Talking

    But i need to be array..... so, any help please

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    No way, some options though:
    1. Enumeration
    Code:
    Enum myenum
     const1 = 1
     const2 = 2
    End Enum
    2. A normal array acts like a constant of arrays, just remember to initialize it
    Code:
    Public Arrayname(2) as variabletype
    .
    .
    Arrayname(0)="HELLO"
    Arrayname(1)="HELLO_2"
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Guest

    Talking

    Since it will work like constant , thinking where is the best place to initialize them... in MDI form load?

  6. #6
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Best place would be the Load event of the form (or MDI form) that loads first, or Sub Main of a module if the project loads from there.

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