Hi,
* this class is defined in assembly XXXXClsLib :
Public class VVDB : inherits DBFuncs
...
* Assembly YYYYFwApi has a reference to XXXXClsLib
* this class B in YYYYFwApi has an imports stmt :
imports XXXXClsLib.VVDB
* and this code of class b gives an error
Private Function zzz() As String
Dim myvvdb as new VVDB <<- VVDB not defined
and an error correction via shift+alt+f10
says use XXXXClsLib.VVDB
well why is that ?
also if I change the imports to
imports VVDB = XXXXClsLib.VVDB
then all is well.
why is that ?
thanks for explanation 7 1728
Try: Imports XXXXClsLib
Instead of: imports XXXXClsLib.VVDB
chaz wrote: Hi, * this class is defined in assembly XXXXClsLib : Public class VVDB : inherits DBFuncs ... * Assembly YYYYFwApi has a reference to XXXXClsLib * this class B in YYYYFwApi has an imports stmt : imports XXXXClsLib.VVDB
* and this code of class b gives an error Private Function zzz() As String
Dim myvvdb as new VVDB <<- VVDB not defined
and an error correction via shift+alt+f10
says use XXXXClsLib.VVDB
well why is that ?
also if I change the imports to
imports VVDB = XXXXClsLib.VVDB
then all is well.
why is that ?
thanks for explanation
yeah that works as well, but why? I have another class in the same assembly
wich requires XXXClsLib.classname in the imports stmt else it's undefined .
Am I missing some underlying concept or is it just try until it works?
thanks
"ssta" wrote: Try: Imports XXXXClsLib Instead of: imports XXXXClsLib.VVDB chaz wrote: Hi, * this class is defined in assembly XXXXClsLib : Public class VVDB : inherits DBFuncs ... * Assembly YYYYFwApi has a reference to XXXXClsLib * this class B in YYYYFwApi has an imports stmt : imports XXXXClsLib.VVDB
* and this code of class b gives an error Private Function zzz() As String
Dim myvvdb as new VVDB <<- VVDB not defined
and an error correction via shift+alt+f10
says use XXXXClsLib.VVDB
well why is that ?
also if I change the imports to
imports VVDB = XXXXClsLib.VVDB
then all is well.
why is that ?
thanks for explanation
Chaz,
In addition to ssta says use XXXXClsLib.VVDB
Than it is not using the import, you have described the full path.
Cor
Hi Chaz,
Thanks for your post!
I assume VVDB is a class name not a namespace name.
In VB.net syntax, there are 2 types of "Imports" statement: "Imports Alias"
and "Namespace Imports".
1. An import alias defines an alias for a namespace or type
2. A namespace import imports all of the members of a namespace or type,
allowing the identifier of each member of the namespace or type to be used
without qualification.
In your scenario, you are using "Namespace Imports" to eliminate the
namespace qualification of "VVDB" class, so you should "Imports" the
namespace of "VVDB" class instead of "Imports" this class itself. Let's
take another example: to use FileStream class in System.IO namespace, we
should import System.IO namespace instead of System.IO.FileStream itself.
If we import System.IO.FileStream itself, the compiler still can not see
FileStream class, because FileStream class is not declared under
System.IO.FileStream, but System.IO.
Imports System.IO.FileStream
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fs As New FileStream '<<this statement generates compile time
error
End Sub
End Class
Why does "imports VVDB = XXXXClsLib.VVDB" eliminate the compile error? This
"imports" applies to "Imports Alias", not "Namespace Imports". By doing
this, you are saying VVDB is an alias of XXXXClsLib.VVDB class, so in
compile time, the compiler will automatically substitute your typed "VVDB"
with "XXXXClsLib.VVDB" class.
Hope this explanation makes things clear.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Below is the VB.net specification regarding "Import Aliases" and
"6.3.1 Import Aliases" http://msdn.microsoft.com/library/de...us/vbls7/html/
vblrfVBSpec5_2_1.asp
"6.3.2 Namespace Imports" http://msdn.microsoft.com/library/de...us/vbls7/html/
vblrfVBSpec5_2_2.asp
For your information.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Jeffrey,
Here is where I got confused (and still am)
Assembly A has to classes
public class VVDB
public function vvx()
public class ASPutility
public shared function Aspfunc() as object <<= note shared
Assembly B has theses two imports
imports A.Asputility
imports A
the 2nd is so we can write
Dim vvdb as new VVDB
instead of
Dim vvdb as new A.VVDB
(which has been discussed )
but the first is so we can write
xxx = AspFunc
instead of
xxx = A.AspFunc
""Jeffrey Tan[MSFT]"" wrote: Below is the VB.net specification regarding "Import Aliases" and "6.3.1 Import Aliases" http://msdn.microsoft.com/library/de...us/vbls7/html/ vblrfVBSpec5_2_1.asp "6.3.2 Namespace Imports" http://msdn.microsoft.com/library/de...us/vbls7/html/ vblrfVBSpec5_2_2.asp
For your information.
Best regards, Jeffrey Tan Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Scott,
Thanks for your feedback!
Yes, this condition falls in the "Namespace Imports" syntax of VB.net. As
you can see in "6.3.2 Namespace Imports", a namespace imports can not only
import a namespace, can it also import a type(class):
"In the case of types, a namespace import only allows access to the shared
members of the type without requiring qualification of the class name. "
This explains why you can eliminate the usage of class name in front of the
shared method.
Additionally, if you are curious, based on my test, the C# "using"
statement(which is the counterpoint to "imports" statement) does not
support this feature. "using" statement can only import the namespace, it
can not be used to import the class/type.
Hope this helps!
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Terje Slettebø |
last post by:
Hi.
I'm new here, and sorry if this has been discussed before; I didn't find it
searching the PHP groups. (I've also read recommendations to cross-post to
the other PHP groups, but if that is...
|
by: Jari Kujansuu |
last post by:
I can successfully parse XML document using SAX or DOM and I can also
validate
XML document against schema.
Problem is that my program should deal with user-defined schemas which means
that when...
|
by: Jacob Jensen |
last post by:
This question has probably been asked a million time, but here it comes
again. I want to learn the difference between the three type cast operators:
static_cast, reinterpret_cast, dynamic_cast. A...
|
by: Nitin Bhardwaj |
last post by:
Hi all,
It is said that C++ is a strongly typed language and thus a type-safe
language (unlike C). So how does one explain the following behaviour :
int main(void)
{
char *p = NULL;
p = "A...
|
by: Rade |
last post by:
Following a discussion on another thread here... I have tried to understand
what is actually standardized in C++ regarding the representing of integers
(signed and unsigned) and their conversions....
| |
by: dawatson833 |
last post by:
I have several stored procedures with parameters that are defined with
user defined data types. The time it takes to run the procedures can
take 10 - 50 seconds depending on the procedure.
If I...
|
by: Matt |
last post by:
I want to know if "int" is a primitive type, or an object?
For example, the following two approaches yield the same result.
> int t1 = int.Parse(TextBox2.Text); //method 1
> int t2 =...
|
by: phil |
last post by:
I recently tried converting my asp.net 1.1 app to 2.0 in visual studio
2005 beta 2.
I get several "type xxx is not defined" errors.
It seems that some of my code file within my web application...
|
by: Michael |
last post by:
Hi,
I could understand the difference between class and object. However, I
could find out a good definiton of type. how to understand the
relaitonship between type, class, and object? Thanks!
...
|
by: garyusenet |
last post by:
I'm using an example piece of code: -
namespace Wintellect.Interop.Sound{
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
sealed class Sound{
public static...
|
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...
| |
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: 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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |