Re: Using Page Object in VB Class File
From: John Saunders (johnwsaundersiii_at_notcoldmail.com)
Date: 06/17/04
- Next message: Joris Dobbelsteen: "Re: ASP.Net Classes"
- Previous message: Mad Scientist Jr: "Validator doesn't work if autopostback=true"
- In reply to: Alex Papadimoulis: "Re: Using Page Object in VB Class File"
- Next in thread: Kevin Spencer: "Re: Using Page Object in VB Class File"
- Reply: Kevin Spencer: "Re: Using Page Object in VB Class File"
- Reply: Alex Papadimoulis: "Re: Using Page Object in VB Class File"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Jun 2004 12:19:39 -0400
"Alex Papadimoulis" <alexRemovePi@pa3.14padimoulis.com> wrote in message
news:eFZd3BIVEHA.2520@TK2MSFTNGP10.phx.gbl...
> John,
>
> No reason to recommend against modules. If you look at the compliation, a
> Module is created as a public singleton class with all methods static
> (shared). Modules are therefore OO. Avoiding them because at one point
they
> were pre-OO is like avoiding methods from the Microsoft.Visualbasic
> namespace (such as Left()) -- it really weakens your toolset as a VB
> programmer for no reason.
Alex,
Can one inherit from a module? Can one add nonstatic members?
Since a class can do everything a module can do plus far more, I see no
reason to use modules at all.
-- John Saunders johnwsaundersiii at hotmail > -- > Alex Papadimoulis > http://weblogs.asp.net/Alex_Papadimoulis > > > "John Saunders" <johnwsaundersiii@notcoldmail.com> wrote in message > news:ORdZBT$TEHA.4064@TK2MSFTNGP11.phx.gbl... > > "Alex Papadimoulis" <alexRemovePi@pa3.14padimoulis.com> wrote in message > > news:%23mR6OI%23TEHA.384@TK2MSFTNGP10.phx.gbl... > > > Bijoy, > > > > > > > - How would I "include" this class in each aspx page? > > > Just create a module in your project. It will be in the assembly, and > > > automatically "included" (accessible) from all your pages. > > > > I personally recommend against modules, which are a pre-OO feature. > Instead, > > go ahead and create a Public class with Public Shared subs and/or > Functions. > > > > > > - How would I call the functions? > > > MyModule.MyFunction( arg1, arg2 ) > > > > MyClass.MyFunction(arg1, arg2) > > > > > > - One of my functions does a "Page.FindControl". How can I make the > Page > > > > object accessible within the class file > > > Function MyFunction( pg as Page ) As String > > > Dim ctrl as Control = pg.FindControl("Blah") > > > If ctrl Is Nothing Then Return "Where Is It" Else Return "Found It" > > > End Sub > > > > Pretty good, but if you make the signature be: > > > > Function MyFunction(ctl as Control) > > > > then you'll be able to handle cases where you don't want to search the > whole > > page. > > -- > > John Saunders > > johnwsaundersiii at hotmail > > > > > >
- Next message: Joris Dobbelsteen: "Re: ASP.Net Classes"
- Previous message: Mad Scientist Jr: "Validator doesn't work if autopostback=true"
- In reply to: Alex Papadimoulis: "Re: Using Page Object in VB Class File"
- Next in thread: Kevin Spencer: "Re: Using Page Object in VB Class File"
- Reply: Kevin Spencer: "Re: Using Page Object in VB Class File"
- Reply: Alex Papadimoulis: "Re: Using Page Object in VB Class File"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|