|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ASP.NET: VSNET2003 to VSNET2005There are several questions I have about the code differences between them (I use VB.NET for as my language of choice): 1. 2003 used "Public Class classname" and 2005 uses "Partial Class classname". What, if any, difference is there between these? 2. The following things are included in the #Region " Web Form Designer Generated Code " part of 2003's code, and are not included automatically in 2005: <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Control declarations, such as: Protected WithEvents lblWebsite As System.Web.UI.WebControls.Label Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init InitializeComponent() End Sub Do I need to include any of these manually or anything else that serves their purpose? 3. In 2003 the Page Events use clauses such as Handles MyBase.Load while 2005 uses Handles Me.Load. I am assuming that these will work the same? I am sure that I will run into the other differences between the two, but these are some of the important ones for me right now. Thanks. the main difference from 2003 to 2005, is how a page is compiled.
in 2003 when asp.net compiled an aspx, it had the page inherit from the code behind file, which VS had compiled into a separate dll. this required the funky double declare of controls, and linking up the events. note there are two compiles, the codebehind into a dll by vs, and each aspx page as a separate dll by the asp.net compiler. in 2005 there is a new feature called partial classes. this allows a class to be broken into two files and compiled together. VS no longer compiles the code behind files into their own dll. the asp.net compiler does all the work, so the codebehind is in the same dll as the aspx page. because the codebehind and the aspx page code is merged thru the magic of partial classes, then a control is defined in aspx, the codebehind knows about it. -- bruce (sqlwork.com) Show quote "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message news:elYA9k9mGHA.1428@TK2MSFTNGP02.phx.gbl... >I just upgraded from Visual Studio .NET 2003 to Visual Studio .NET 2005. >There are several questions I have about the code differences between them >(I use VB.NET for as my language of choice): > > 1. 2003 used "Public Class classname" and 2005 uses "Partial Class > classname". What, if any, difference is there between these? > > 2. The following things are included in the #Region " Web Form Designer > Generated Code " part of 2003's code, and are not included automatically > in 2005: > > <System.Diagnostics.DebuggerStepThrough()> Private Sub > InitializeComponent() > End Sub > > > Control declarations, such as: > Protected WithEvents lblWebsite As System.Web.UI.WebControls.Label > > > Private designerPlaceholderDeclaration As System.Object > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Init > InitializeComponent() > End Sub > > Do I need to include any of these manually or anything else that serves > their purpose? > > 3. In 2003 the Page Events use clauses such as Handles MyBase.Load while > 2005 uses Handles Me.Load. I am assuming that these will work the same? > > > I am sure that I will run into the other differences between the two, but > these are some of the important ones for me right now. Thanks. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > 1) A partial class just means that the class is split across one or more
files. "Partial" has no effect on whether a class is public or private. 2) No 3) Yes Show quote "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message news:elYA9k9mGHA.1428@TK2MSFTNGP02.phx.gbl... >I just upgraded from Visual Studio .NET 2003 to Visual Studio .NET 2005. >There are several questions I have about the code differences between them >(I use VB.NET for as my language of choice): > > 1. 2003 used "Public Class classname" and 2005 uses "Partial Class > classname". What, if any, difference is there between these? > > 2. The following things are included in the #Region " Web Form Designer > Generated Code " part of 2003's code, and are not included automatically > in 2005: > > <System.Diagnostics.DebuggerStepThrough()> Private Sub > InitializeComponent() > End Sub > > > Control declarations, such as: > Protected WithEvents lblWebsite As System.Web.UI.WebControls.Label > > > Private designerPlaceholderDeclaration As System.Object > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Init > InitializeComponent() > End Sub > > Do I need to include any of these manually or anything else that serves > their purpose? > > 3. In 2003 the Page Events use clauses such as Handles MyBase.Load while > 2005 uses Handles Me.Load. I am assuming that these will work the same? > > > I am sure that I will run into the other differences between the two, but > these are some of the important ones for me right now. Thanks. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > Nathan,
If you are converting than you can decide to do it this way, Be aware that this adds a fourth method how you can use ASPX in version 2005 http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/default.aspx I hope this helps, Cor Show quote "Nathan Sokalski" <njsokal***@hotmail.com> schreef in bericht news:elYA9k9mGHA.1428@TK2MSFTNGP02.phx.gbl... >I just upgraded from Visual Studio .NET 2003 to Visual Studio .NET 2005. >There are several questions I have about the code differences between them >(I use VB.NET for as my language of choice): > > 1. 2003 used "Public Class classname" and 2005 uses "Partial Class > classname". What, if any, difference is there between these? > > 2. The following things are included in the #Region " Web Form Designer > Generated Code " part of 2003's code, and are not included automatically > in 2005: > > <System.Diagnostics.DebuggerStepThrough()> Private Sub > InitializeComponent() > End Sub > > > Control declarations, such as: > Protected WithEvents lblWebsite As System.Web.UI.WebControls.Label > > > Private designerPlaceholderDeclaration As System.Object > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Init > InitializeComponent() > End Sub > > Do I need to include any of these manually or anything else that serves > their purpose? > > 3. In 2003 the Page Events use clauses such as Handles MyBase.Load while > 2005 uses Handles Me.Load. I am assuming that these will work the same? > > > I am sure that I will run into the other differences between the two, but > these are some of the important ones for me right now. Thanks. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > |
|||||||||||||||||||||||