473,324 Members | 2,473 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,324 software developers and data experts.

can I use Imports with a VB2005 class namespace?

Hello,

I have a project (vb2005) and I added a class (a vb file) that resides in a
separate directory from the main project. Rather than instantiating objects
from this class to use its properties and methods, is it possible to use the
Imports keyword like in C# to import that class namespace?

How can this be done? or how can something equivalnet be done?

Thanks,
Rich
Aug 22 '06 #1
3 1068
"Rich" <Ri**@discussions.microsoft.comschrieb:
I have a project (vb2005) and I added a class (a vb file) that resides in
a
separate directory from the main project. Rather than instantiating
objects
from this class to use its properties and methods, is it possible to use
the
Imports keyword like in C# to import that class namespace?
You can assign a namespace to the file using the 'Namespace' block. Then
you can import the namespace and instantiate/use the class. In addition you
can even import the class in order to be able to access its shared members
without qualification by the class name.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Aug 22 '06 #2
I think I figured this out. I gieve the added class a namespace name
(without including the project name as part of the namespace unlike C#).
Then when I type Imports in the main class I will see the project name in the
initial listing, I select the project name, then I see the class(es) I add to
the project.

"Rich" wrote:
Hello,

I have a project (vb2005) and I added a class (a vb file) that resides in a
separate directory from the main project. Rather than instantiating objects
from this class to use its properties and methods, is it possible to use the
Imports keyword like in C# to import that class namespace?

How can this be done? or how can something equivalnet be done?

Thanks,
Rich
Aug 22 '06 #3
Rich,

Did you look at the answer from Herfried, seems for me quiet the same.
The times of sending are equal, but I get the idea because that there is no
reply on Herfried answer that you did not even look at that. Knowing that
set you on a lower answering priority.

Cor

"Rich" <Ri**@discussions.microsoft.comschreef in bericht
news:85**********************************@microsof t.com...
>I think I figured this out. I gieve the added class a namespace name
(without including the project name as part of the namespace unlike C#).
Then when I type Imports in the main class I will see the project name in
the
initial listing, I select the project name, then I see the class(es) I add
to
the project.

"Rich" wrote:
>Hello,

I have a project (vb2005) and I added a class (a vb file) that resides in
a
separate directory from the main project. Rather than instantiating
objects
from this class to use its properties and methods, is it possible to use
the
Imports keyword like in C# to import that class namespace?

How can this be done? or how can something equivalnet be done?

Thanks,
Rich

Aug 23 '06 #4

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

Similar topics

3
by: | last post by:
I'm picking up an 'IMPORTS' error for a simple database insert based on two input entry boxes in my form? It says an 'Imports' statement must preceede any declarations....... is this perahps the...
2
by: Shapper | last post by:
Hello, In the main root of my web site together with my aspx and aspx.vb files I have the file global.vb. This file has a class with all the functions which are used in many aspx.vb files and...
5
by: Shapper | last post by:
Hello, I am working in a web site where all the code is placed in aspx.vb files. After a while I realized that many functions included in my aspx.vb files where common to all pages. I...
1
by: Jim Heavey | last post by:
Hello, I am trying to understand how to properly use the "reference" and "imports". If I create a "solution" with 2 projects, do they both sare the same namespace? When I use the IDE to...
19
by: Tiraman | last post by:
Hi , I have an assembly that hold few class and few imports which are not used in all of the class's . so my question is when to use the "Imports XXX" And when to use this kind of statement...
4
by: Jeff Jarrell | last post by:
I am not really there yet with namespaces. I have a "common.dll" that is referenced from another project. now in the consuming project, source file to i'd like to have a "imports common". ...
2
by: Jason | last post by:
I'm trying to work with the WMI class in the System.Management namespace with Visual Basic.Net. I copied and pasted some example code from Microsoft that contains the following namespace imports: ...
1
by: Arpan | last post by:
What's the difference between "Imports" & "Inherits"? For e.g. both the codes below work without any errors: Imports System Imports System.Data Imports System.Web.UI Namespace Constructors...
6
by: douglass_davis | last post by:
Is the whole System namespace automatically imported?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.