Not sure why you are referring to "using" when it is "imports" that we are
discussing, but anyway, don't import the class, just the namespace. Then
your code would be:
************************************************** *****
Imports MyFunctions
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fw = New FWData(10)
Dim j As Integer = fw.ErrorCode
End Sub
End Class
************************************************** ****
When you import a namespace, you no longer have to fully qualify statements
that include elements of that imported namespace. If you import a class,
you can access certain elements of the class without fully qualifying them.
Your idea doesn't work because if you import this way:
Imports MyFunctions.FWData
You can now get at certain FWData class members without having to qualify
"MyFunctions.FWData".
But, when you write:
Dim fw = new FWData(10)
FWData is not found because the namespace that contains FWData has not been
imported, you are importing PAST that level.
"tshad" <t@home.comwrote in message
news:O1**************@TK2MSFTNGP02.phx.gbl...
>I have a .dll that has MyFunctions as a Namespace and Class of FWData.
If I have my using statement as:
using MyFunctions.FWData
Why do I have to set a new variable as:
Dim fw = New MyFunctions.FWData(10)
Why can't I do:
Dim fw = new FWData(10)
This gives me an error:
C:\VSProjects\TestFWData\Form1.vb(73): Type 'FWData' is not defined.
Why is that? If I have it defined in my using statement - why do I need
the namespace?
The whole code is:
************************************************** *****
Imports MyFunctions.FWData
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fw = New MyFunctions.FWData(10)
Dim j As Integer = fw.ErrorCode
End Sub
End Class
************************************************** ****
Thanks,
Tom