Why use Dim outside of sub?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brett

    Why use Dim outside of sub?

    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


  • Shane Story

    #2
    Re: Why use Dim outside of sub?

    I'm pretty sure there is no difference and they just allow either. Both
    would be module level scoped variables and private.

    HTH,

    Shane

    "Brett" <no@spam.com> wrote in message
    news:umXDNCqPFH A.1268@TK2MSFTN GP14.phx.gbl...[color=blue]
    > 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
    >[/color]


    Comment

    • Cor Ligthert

      #3
      Re: Why use Dim outside of sub?

      Brett,[color=blue]
      > Public Class Form1
      > Inherits System.Windows. Forms.Form
      > Dim myUrl As String
      >
      > and
      > Private myUrl As String[/color]

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

      Cor


      Comment

      Working...