Home All Groups Group Topic Archive Search About

Why use Dim outside of sub?

Author
11 Apr 2005 2:12 PM
Brett
What is the difference in:

Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim myUrl As String

and
    Private myUrl  As String

In other words, using Dim or Private outside of a sub.  Both can be seen
within any sub in that class..  Private seems more explicit.  I'm also
assuming that Dim keeps the variable scoped only within that class, just
like Private.

Thanks,
Brett

Author
11 Apr 2005 2:24 PM
Shane Story
I'm pretty sure there is no difference and they just allow either.  Both
would be module level scoped variables and private.

HTH,

Shane

Show quoteHide quote
"Brett" <no@spam.com> wrote in message
news:umXDNCqPFHA.1268@TK2MSFTNGP14.phx.gbl...
> What is the difference in:
>
> Public Class Form1
>    Inherits System.Windows.Forms.Form
>    Dim myUrl As String
>
> and
>    Private myUrl  As String
>
> In other words, using Dim or Private outside of a sub.  Both can be seen
> within any sub in that class..  Private seems more explicit.  I'm also
> assuming that Dim keeps the variable scoped only within that class, just
> like Private.
>
> Thanks,
> Brett
>
Author
11 Apr 2005 5:35 PM
Cor Ligthert
Brett,
> Public Class Form1
>    Inherits System.Windows.Forms.Form
>    Dim myUrl As String
>
> and
>    Private myUrl  As String

A mather of personal preference they are in this case both private inside
the class

Cor