Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Dim versus Private


Reply
 
Thread Tools Display Modes
  #1  
Old 01-20-2012, 10:36 AM
kyeohti kyeohti is offline
Centurion
 
Join Date: Jan 2004
Location: Portland, Oregon
Posts: 135
Default Dim versus Private


I think declaring a variable using Dim in .NET accomplishes the same as declaring it using the Private keyword, but I would like to confirm.

Thanks,

Kyeohti
Reply With Quote
  #2  
Old 01-20-2012, 12:14 PM
AtmaWeapon's Avatar
AtmaWeapon AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,505
Default

The answer is sort of complicated.

Inside of a method/property, Dim is always required and none of the access specifiers make sense, so let's ignore that.

Outside of a method/property, Dim is optional. It is generally preferred to use one of the access specifiers. It's easier to remember what "Private" means than it is to memorize the syntax rules for VB. But there are rules, and if you want to memorize them, here they are. as you'll see, sometimes Dim means Private, other times it means Public. If you want Private, use Private.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->