Results 1 to 5 of 5

Thread: global declartion of STRING

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Can anyone tell me how to set a string globally?

    Many thanks

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Form wide - Put the line with "dim" in the general declarations section
    Project wide - Put this line in a module
    Code:
    Public WhatEver As String

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446

    FORM WIDE?

    Whats form wide? i'm not really VB man?

    Many Thanks

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    oetje is talking about scope.

    If you want your variable to be accessed and changed from ANYWHERE in your project (all forms, classes, modules, ect.) then declare it as Public in a module.

    If you want your variable to be accessed and changed from any procedure in a form, but NOT the other forms/modules in your project then declare it Private (or Dim) in the General Declarations section of the form only.

    Generally you want to give your variables as little scope as necessary so that they are safe from being changed by those who have no business changing them.

    Hope that helps,
    ~seaweed

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    CHEERS

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