Thursday, March 29, 2012

Separating my VB classes into different files

Here's my scenario: I have a page default.aspx with the header directive
<%@dotnet.itags.org. Page aspcompat=true Language="VB" Debug="true" Inherits="forms" src="http://pics.10026.com/?src=forms.vb"%>
So I have the file forms.vb that contains the class "Forms", and that class references some custom controls I've made such as "FormPageControl" and it works just fine when I have FormPageControl defined in forms.vb, which I can do, but I want to be able to give it its own vb file, so I made a file called "FormPageControl.vb" and moved the class into that file. But how do I link forms.vb to FormPageControl.vb (like in C++ I would use the line: #include "FormPageControl.h" is there something simmilar in VB.NET so that the Just in Time compiler knows to look in FormPageControl.vb for the class named FormPageControl?

Is FormPageControl a user control? If so just use the @.Controltag to declare it on the aspx page and put it in a separate ascx file.
http://www.ondotnet.com/pub/a/dotnet/excerpt/progaspdotnet_14/index1.html

FormPageControl is a vb class that inherits Repeater. There is no ascx file associated with it
What's the error you are getting when you try to compile? Make sure you have the appropriate Imports statement.

0 comments:

Post a Comment