Declaring Instance of Class

Mayfield2268

Active member
Joined
Feb 24, 2003
Messages
30
I have created a class called EmployeeInfo with a namespace of EmployeeInfo. When I try to create an instance of this class in my .aspx page, I get the following error...

BC30002: Type EmployeeInfo is not defined.

Source Error:

Line 13: Page.DataBind()
Line 14: End If
Line 15: Dim Emp as new EmployeeInfo()
Line 16: End Sub

I have added this line at the top...
<%@ import Namespace="EmployeeInfo" %>

Does anyone have suggestions on how to create an instance of a class.

Thanks

PS Im using Asp.Net Web Matrix
Jason Lee Mayfield
 
I get the same error

Compiler Error Message: BC30002: Type EmployeeInfo.EmployeeInfo is not defined.

Source Error:

Line 13: Page.DataBind()
Line 14: End If
Line 15: Dim Emp as new EmployeeInfo.EmployeeInfo()
Line 16: End Sub
Line 17:

I removed the import statement.

Here is the class if this helps...


Imports System
Namespace EmployeeInfo
Public Class EmployeeInfo
Public Sub New()

End Sub
End Class
End Namespace

Thanks
 
Well it really depends on how u are developing. If you are using the VS.NET environment, then u add a class (class1) to the solution. From your webform, you go the the back end code and under whatever subroutine you wish to use (i.e. Pageload) you type in :

Dim instClass1 as new Class1

There is no need to use any other references to class1 since it is in the same solutuion.

You may want to create a new webform alltogether to try this out.
This method only works this way if you use VSNET dev envionment thogh...
 
Thanks

Im actually using asp.net Web Matrix. I have created a folder and the .aspx page and the .vb page are in this folder yet I still get this error.

Any other thoughts

Thanks
 
Back
Top