Web Matrix and using classes

Mayfield2268

Active member
Joined
Feb 24, 2003
Messages
30
I have created a class in Web Matrix and Im trying to call it from a .aspx page. Here is the code for the class...


Imports System
Namespace sqlClass
Public Class sql
Public Sub New()

End Sub
End Class
End Namespace

I get the following error when I try to declare an instance of this class in my .aspx page ...

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

Source Error:

Line 6:
Line 7: Sub Button1_Click(sender As Object, e As EventArgs)
Line 8: Dim sqlVB as New sql()
Line 9:
Line 10: End Sub

I have also tried adding a import namespace as well as removing the Namespace code from the class.


Does anyone have any suggestions as to why this error is occurring.

Thanks
 
Did you compile the class? Web Matrix does not do this for you, as its meant to be used with Active Server Pages (.NET) that lack code-behind files.
 
Thanks for the response

I was able to compile the .vb file into a dll file. But of course Im not sure what to do next. I try adding the dll to the classes tab in Web Matrix but that didnt seem to work.

Any suggestions

Thanks
 
Copy the DLL into the /bin directory of your web applications root. If the directory doesnt exist, create it. Then simply import the namespace.
Code:
<%@ Import Namespace="MyCompany.MyProject" %>
 
Back
Top