using a class

m0dest0

New member
Joined
Jul 30, 2011
Messages
1
Programming Experience
Beginner
hi, i got a sample from internet and i'd like to test it but this sample contains only a vb file (not form) so i added a new form into the project, i also added a button there but I don't know how imports the code from the unit, e.g.

the unit code starts as below
VB.NET:
Namespace PC
    Public Class ADWrapper

so, my form starts as
VB.NET:
Imports PC
Public Class TestingAD
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim MyADWrapper As ADWrapper = New ADWrapper()

but i get "Type 'ADWrapper' is not defined"

so my question is how I should proceed to use the methods from the namespace PC or the ADWrapper class.

Thanks in advance,
m0dest0.
 
I don't know how imports the code from the unit
Add a new class file to the project and copy-paste the class you found. (maybe you already did this)
but i get "Type 'ADWrapper' is not defined"
Are you sure you don't get an error in the Imports statement first? All projects have a root namespace by default, so when you add a namespace within this those are nested, for example WindowsApp.PC. Resolve that and the type will be available. Error correction options provided will automatically list the correct namespace.
 
Back
Top