Why use Dim outside of sub?

  • Thread starter Thread starter Brett
  • Start date Start date
B

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
 
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,
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top