473,507 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 21 '05 #1
1 1056

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)


Nov 21 '05 #2

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

Similar topics

4
4630
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
1
2181
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...
3
1498
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...
3
1382
by: Chris B. | last post by:
I'm getting some strange results in an asp.net web application that has recently gone live. In the header of almost all the pages, the full name of the currently logged in user is displayed. On...
2
14811
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
1063
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...
0
980
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
2331
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
1828
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
3231
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
7223
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
7110
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
7372
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...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.