472,779 Members | 2,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 2127

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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.