Results 1 to 6 of 6

Thread: Difference between string and string variant

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    30

    Difference between string and string variant

    Hey guys can u tell me an anwer of one basic question

    what is the difference between String and String Variant

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Difference between string and string variant

    VB declares all variables as variant unless you declare them as something else.
    There isn't really a string variant. It would be just a variant.
    Variants waste memory.

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Difference between string and string variant

    A string holds text... a variant holds anything.. (Objects, Numbers, Arrays, Text)

    so you can put a string in a variant.. but if you know it will be a string.. declare as a string. (Uses less memory)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Difference between string and string variant

    You should NEVER use variants as they consume too much memory and working with variants is much slower then with a regular type variable. So remember to always declare your variables properly.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    30

    Re: Difference between string and string variant

    THanks a lot i got it

  6. #6
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Difference between string and string variant

    While variants (only if numbers are being used) are 16 bytes (128 bits), if a string is used in there, it becomes a string variant, and ends up being 22 bytes + word lenght! It would compute a whole lot slower than a regular string. So always declare your variables.

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