Showing posts with label language. Show all posts
Showing posts with label language. Show all posts

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.

Sequence of code processing

I am fairly new to ASP.Net and am using VS2005 and .Net 2.0 for page
creation. I am using VB as a language and have VB code between script tags
at the top of my page. I also have a button on my page that runs a
Protected Sub that performs some processing when clicked as noted below:
Protected Sub BtnNewSubfile_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnNewSubfile.Click
...
End Sub
Does this code run before the code at the top of the page or after. Or does
the code at the top of the page run at all when I click the button? Thanks.
DavidDavid,
ASP.Net doesn't run in a linear fashion as classic ASP did. It's
completely event-driven. That means your button click event will be fired at
a particular time based on the design of ASP.Net, not based upon the
location of the code. Paul Wilson has a great article listing all the
various events that will occur on a page and the order in which they occur
at: http://blogs.crsw.com/mark/articles/471.aspx
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"David" <dlchase@.lifetimeinc.com> wrote in message
news:%236lzifv8GHA.4996@.TK2MSFTNGP03.phx.gbl...
>I am fairly new to ASP.Net and am using VS2005 and .Net 2.0 for page
>creation. I am using VB as a language and have VB code between script tags
>at the top of my page. I also have a button on my page that runs a
>Protected Sub that performs some processing when clicked as noted below:
> Protected Sub BtnNewSubfile_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles BtnNewSubfile.Click
> ...
> End Sub
>
> Does this code run before the code at the top of the page or after. Or
> does the code at the top of the page run at all when I click the button?
> Thanks.
> David
>
Thank you Mark. I'll check it out.
David
"Mark Fitzpatrick" <markfitz@.fitzme.com> wrote in message
news:%23MkA$hx8GHA.4572@.TK2MSFTNGP02.phx.gbl...
> David,
> ASP.Net doesn't run in a linear fashion as classic ASP did. It's
> completely event-driven. That means your button click event will be fired
> at a particular time based on the design of ASP.Net, not based upon the
> location of the code. Paul Wilson has a great article listing all the
> various events that will occur on a page and the order in which they occur
> at: http://blogs.crsw.com/mark/articles/471.aspx
> --
> Hope this helps,
> Mark Fitzpatrick
> Former Microsoft FrontPage MVP 199...2006
> "David" <dlchase@.lifetimeinc.com> wrote in message
> news:%236lzifv8GHA.4996@.TK2MSFTNGP03.phx.gbl...
>

Sequence of code processing

I am fairly new to ASP.Net and am using VS2005 and .Net 2.0 for page
creation. I am using VB as a language and have VB code between script tags
at the top of my page. I also have a button on my page that runs a
Protected Sub that performs some processing when clicked as noted below:

Protected Sub BtnNewSubfile_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnNewSubfile.Click

...

End Sub

Does this code run before the code at the top of the page or after. Or does
the code at the top of the page run at all when I click the button? Thanks.

DavidDavid,
ASP.Net doesn't run in a linear fashion as classic ASP did. It's
completely event-driven. That means your button click event will be fired at
a particular time based on the design of ASP.Net, not based upon the
location of the code. Paul Wilson has a great article listing all the
various events that will occur on a page and the order in which they occur
at: http://blogs.crsw.com/mark/articles/471.aspx
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"David" <dlchase@.lifetimeinc.comwrote in message
news:%236lzifv8GHA.4996@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>I am fairly new to ASP.Net and am using VS2005 and .Net 2.0 for page
>creation. I am using VB as a language and have VB code between script tags
>at the top of my page. I also have a button on my page that runs a
>Protected Sub that performs some processing when clicked as noted below:
>
Protected Sub BtnNewSubfile_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnNewSubfile.Click
>
...
>
End Sub
>
>
>
Does this code run before the code at the top of the page or after. Or
does the code at the top of the page run at all when I click the button?
Thanks.
>
David
>


Thank you Mark. I'll check it out.

David
"Mark Fitzpatrick" <markfitz@.fitzme.comwrote in message
news:%23MkA$hx8GHA.4572@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

David,
ASP.Net doesn't run in a linear fashion as classic ASP did. It's
completely event-driven. That means your button click event will be fired
at a particular time based on the design of ASP.Net, not based upon the
location of the code. Paul Wilson has a great article listing all the
various events that will occur on a page and the order in which they occur
at: http://blogs.crsw.com/mark/articles/471.aspx
>
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
>
"David" <dlchase@.lifetimeinc.comwrote in message
news:%236lzifv8GHA.4996@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>>I am fairly new to ASP.Net and am using VS2005 and .Net 2.0 for page
>>creation. I am using VB as a language and have VB code between script
>>tags at the top of my page. I also have a button on my page that runs a
>>Protected Sub that performs some processing when clicked as noted below:
>>
>Protected Sub BtnNewSubfile_Click(ByVal sender As Object, ByVal e As
>System.EventArgs) Handles BtnNewSubfile.Click
>>
>...
>>
>End Sub
>>
>>
>>
>Does this code run before the code at the top of the page or after. Or
>does the code at the top of the page run at all when I click the button?
>Thanks.
>>
>David
>>


>
>