where to declare variables 
Author Message
 where to declare variables

I would like to declare a variable for the whole module, so before the
class, I used the dim statement, but I noticed in a sub that it complained
that a variable was not declared.  This seems a little different than VBA.
Can anybody help?
Option Explicit On
    Dim txtPlayer As String
    Dim txtComputer As String
    Dim x as Integer

        Public Class RPS...
            statements
        End Class
--
Jeff Ciaccio
Physics and AP Physics Teacher
Sprayberry High School; Marietta, GA
Blog: http://www.*-*-*.com/



Sat, 11 Dec 2010 22:39:54 GMT  
 where to declare variables

Quote:

>I would like to declare a variable for the whole module, so before the class, I used the dim statement, but I noticed in a sub that
>it complained that a variable was not declared.  This seems a little different than VBA. Can anybody help?
> Option Explicit On
>    Dim txtPlayer As String
>    Dim txtComputer As String
>    Dim x as Integer

>        Public Class RPS...
>            statements
>        End Class

Again, you need to ask in a dotnet newsgroup. VB.NET is more than a little different from VB6 and/or VBA.

--
Mike
Microsoft Visual Basic MVP



Sat, 11 Dec 2010 23:13:15 GMT  
 where to declare variables

released on Tue, 24 Jun 2008 10:39:54 -0400 bearing the
following fruit:

Quote:
>I would like to declare a variable for the whole module, so before the
>class, I used the dim statement, but I noticed in a sub that it complained
>that a variable was not declared.  This seems a little different than VBA.
>Can anybody help?
>Option Explicit On
>    Dim txtPlayer As String
>    Dim txtComputer As String
>    Dim x as Integer

>        Public Class RPS...
>            statements
>        End Class

Is this a VB.Net question or a VB6 question?
--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde



Sat, 11 Dec 2010 23:17:18 GMT  
 where to declare variables
My bad.

Is there a free VB 6.0 version?

Thanks

Quote:



>>I would like to declare a variable for the whole module, so before the
>>class, I used the dim statement, but I noticed in a sub that it complained
>>that a variable was not declared.  This seems a little different than VBA.
>>Can anybody help?
>> Option Explicit On
>>    Dim txtPlayer As String
>>    Dim txtComputer As String
>>    Dim x as Integer

>>        Public Class RPS...
>>            statements
>>        End Class

> Again, you need to ask in a dotnet newsgroup. VB.NET is more than a little
> different from VB6 and/or VBA.

> --
> Mike
> Microsoft Visual Basic MVP



Sat, 11 Dec 2010 23:19:17 GMT  
 where to declare variables

Quote:

> My bad.

> Is there a free VB 6.0 version?

There used to be a Working Model edition. It was primarily included with beginners books for VB6. I have no idea if you can
download, much less even find, this anymore.  Regardless, the Working Model edition did not allow you to compile your projects so it
really wasn't much good for anything other than learning VB6 with the intent of eventually purchasing VB6.

--
Mike
Microsoft Visual Basic MVP



Sat, 11 Dec 2010 23:30:28 GMT  
 where to declare variables
Thanks Mike.

Sorry about the next post.  I did not realize this one went through :(


Quote:



>> My bad.

>> Is there a free VB 6.0 version?

> There used to be a Working Model edition. It was primarily included with
> beginners books for VB6. I have no idea if you can download, much less
> even find, this anymore.  Regardless, the Working Model edition did not
> allow you to compile your projects so it really wasn't much good for
> anything other than learning VB6 with the intent of eventually purchasing
> VB6.

> --
> Mike
> Microsoft Visual Basic MVP



Sat, 11 Dec 2010 23:34:12 GMT  
 where to declare variables

Quote:

> Sorry about the next post.  I did not realize this one went through :(

It sometimes take a few minutes (or longer) for a post to appear. So if you don't see it right away, just be patient for a few
minutes longer (and make sure you refresh your message list).

--
Mike
Microsoft Visual Basic MVP



Sat, 11 Dec 2010 23:39:14 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Don't Know How to Publicly Declare Variable

2. How to declare variables set in form proc but used after form unloaded

3. for/next loop, declaring variables in VB.Net

4. Problem declaring variable of type Recordset

5. Scope of non declared variable

6. Help declaring variable? (overflow problem)

7. Trapping un-declared variables

8. Someone help me about declaring variable

9. Cannot assign a variable declared as a string to a variable declared as data type

10. Does declaring variables up front incur a performance hit.

11. Unload a form does not unload declared variables!!!! Is that TRUE?????????

12. How to access declared variables from the Document object?

 

 
Powered by phpBB® Forum Software