1. Home
  2. Computing & Technology
  3. Visual Basic
photo of Dan Mabbutt
Dan's Visual Basic Blog

By Dan Mabbutt, About.com Guide to Visual Basic since 2002

Intellisense and Friend

Wednesday May 7, 2008

Matías asked this question:

I have written a program library with a whole structure of classes. When I use the library in another project, all of the classes can be selected.

How can I code the library so that only one class shows up in Intellisense.

----------

Great question, Matías. That's what access modifiers are for. You mentioned that you tried one of them: "Private" but then the program wouldn't work. The one you want is "Friend." The documentation for "Friend" states:

In many cases, you want programming elements such as classes and structures to be used by the entire assembly, not only by the component that declares them. However, you might not want them to be accessible by code outside the assembly, for example if the application is proprietary. If you want to limit access to an element in this way, you can declare it with Friend.

That way, you get this result in Intellisense:

Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2009 About.com, a part of The New York Times Company.

All rights reserved.