Results 1 to 6 of 6

Thread: Variable updation...

  1. #1

    Thread Starter
    Addicted Member samkud's Avatar
    Join Date
    Oct 2001
    Location
    India
    Posts
    171

    Variable updation...

    Hi everybody,

    I created a variable in a module and tried to assign it a value in the module itself. But it gives some error. My question is, is it not possible to assign a value to a varaiable in the module? Also do i need to assign the value in a procedure.

    Please help.

    Thanx.

    Regards

    Samir.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You can assign in a value from anywhere.
    You're obviously ****ing up the code somehow...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    what error does it give???
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  4. #4
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313
    You have to assign it a value from within a procedure of some sort, you can't do this:

    VB Code:
    1. Option Explicit
    2.  
    3. Dim strVariable as String
    4.  
    5. strVariable="Hello world"  'can't do this
    6.  
    7. Private Sub DoSomething()
    8.     strVariable="Hello world"  'can do this
    9. End sub

  5. #5

    Thread Starter
    Addicted Member samkud's Avatar
    Join Date
    Oct 2001
    Location
    India
    Posts
    171

    Hi darre1

    It gives me the compile error "Invalid outside procedure"
    when I try to run it

    Global gvar As Integer
    gvar = 10

    The code above is what i wrote in the module......

  6. #6

    Thread Starter
    Addicted Member samkud's Avatar
    Join Date
    Oct 2001
    Location
    India
    Posts
    171

    Thanx everybody

    Thanx everybody for your valuable information.

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