473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Intellisense, public modules, and public methods

I'm working in VB.Net, using Visual Studio 2003.

I have a project, let's call it Foo, that contains common methods, forms,
and objects I use in other projects. It compiles as Foo.dll, which I then
reference from the project that needs it.

Let's say I have a method, Bar, that I want to access from another project.
If I add a public module Methods to Foo, and add a public method Bar to
Methods, I can call it from my other project a couple of different ways, and
intellisense acts differently.

This works, but with no intellisense:
Foo.Bar

This works:
Foo.Methods (shows in intellisense)
and then:
Foo.Methods.Bar (shows in intellisense)

If, INSTEAD, I create a public class IO in Foo, and a public shared method
Bar in IO, I can call it like so (without instantiating a copy of the IO
class):

Foo.Bar (doesn't work)
Foo.IO.Bar (works, and shows in intellisense)

However, Microsoft, with their awesome powers, has a Namespace
Microsoft.VisualBasic, with a public module Strings, and a public method
UCase.

This works, even if I don't have Microsoft.VisualBasic imported:

UCase("string") (shows in intellisense)
Microsoft.VisualBasic.UCase("string") (shows in intellisense)
Microsoft.VisualBasic.Strings.UCase("string") (shows in intellisense)

I guess what I want is to have a Foo.dll, with a public module or class,
with the public method Bar, and be able to do this:

Foo.Bar

WITH intellisense. Microsoft can do it, why can't I? I appreciate any
assistance.
--
Christopher W. Douglas
SRS Technologies, Inc.
christopher (dot) douglas (at) srs (dot) com
Jul 21 '05 #1
1 2170

Christopher W. Douglas wrote:
Let's say I have a method, Bar, that I want to access from another project. If I add a public module Methods to Foo, and add a public method Bar to Methods, I can call it from my other project a couple of different ways, and intellisense acts differently.

This works, but with no intellisense:
Foo.Bar
I wouldn't expect that to work because Bar is not a member of Foo but
of Methods.

This works:
Foo.Methods (shows in intellisense)
and then:
Foo.Methods.Bar (shows in intellisense)
That is the expected behavior

If, INSTEAD, I create a public class IO in Foo, and a public shared method Bar in IO, I can call it like so (without instantiating a copy of the IO class):

Foo.Bar (doesn't work)
Again, since Bar is not a member of Foo but of IO, I would not expect
this to work.
Foo.IO.Bar (works, and shows in intellisense)

This is the behavior I would expect.
However, Microsoft, with their awesome powers, has a Namespace
Microsoft.VisualBasic, with a public module Strings, and a public method UCase.

This works, even if I don't have Microsoft.VisualBasic imported:

UCase("string") (shows in intellisense)
Did you check your project properties to see if the VisualBasic
namespace was imported by default?
Microsoft.VisualBasic.UCase("string") (shows in intellisense)
Hmmm... I'm not sure how this works. It makes no sense. I checked
the IL and it seems to map to the function in the Strings namespace.
The only UCase I can find is Microsoft.VisualBasic.Strings.UCase. I'm
not sure how MS is pulling of this bit of wizardry. Maybe someone who
knows more about the internals of .Net can shed some light?
Microsoft.VisualBasic.Strings.UCase("string") (shows in intellisense)


Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
3
by: thdevdex | last post by:
I'm new to the web forms world (ASP.Net) but not vb and am converting a vb6 windows app to the web. If I create public subroutines at a module level, is this a problem in a server based app? Will...
2
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
1
by: Vera | last post by:
I have the following coded elements: 1. An interface 2. A baseclass implementing the interface 3. A subclass that inherits the baseclass and contains some extra properties and methods I use my...
1
by: Christopher W. Douglas | last post by:
I'm working in VB.Net, using Visual Studio 2003. I have a project, let's call it Foo, that contains common methods, forms, and objects I use in other projects. It compiles as Foo.dll, which I...
0
by: Ryan | last post by:
Hi all, If I open an asp page and am using a vb6 dll, I get intellisense when I use the Server.CreateObject syntax. When I create a dll using vb.net, the methods and functions work, but I get...
9
by: Rudy | last post by:
Hello All! I'm a little confused on Public Class or Modules. Say I have a this on form "A" Public Sub Subtract() Dim Invoice As Decimal Dim Wage As Decimal Static PO As Decimal Invoice =...
1
by: Kimmo Laine | last post by:
Hi, is there a way to hide inherited methods from the IntelliSense-menu in VS2005? Lets say that i have the following: internal class MyClass { public const int MAX_COUNT = 10; }
5
by: wal | last post by:
Hello, I'm using __declspec(property) to access get/set methods as properties (like in C# and VB.NET). Now, the problem is that both the property name and the get/set methods show in the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.