Re: Using Page Object in VB Class File

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: John Saunders (johnwsaundersiii_at_notcoldmail.com)
Date: 06/17/04


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
> >
> >
>
>


Relevant Pages

  • Re: Sony FX1 (or Z1U)??
    ... thanks so much for the recap John i absolutely loved the build at the end. ... become the STANDARD like sony used to be with beta. ... one reason stated to me sounded ... >>camera recording in all the camera control phases as well as both SD 4:3 ...
    (rec.video.production)
  • from e-mail this morning
    ... OMG finally 2 good reasons to vote for John. ... the Right Reverend "God Damn America" ... your pastor is NOT the reason I am NOT voting for you. ...
    (soc.retirement)
  • Re: "Here Today" lyric
    ... Because there wasnt any reason left to keep it all inside" ... Canada, The Beatles are escorted by police to the airport where, hoping ... Florida and that Paul and John got drunk. ... And then there is Here Today, the song he wrote in the wake of John Lennon's ...
    (rec.music.beatles)
  • Re: Dispute over- apologies sent -everyone happy - nothing to see here
    ... private emails. ... they are called private for a reason - they ... John I dont agree with the mannerisms or language you used. ... Take a gander at some of your own fine posting language a few ...
    (rec.games.pinball)
  • Re: Now this is funny
    ... I have no doubt that John is a nice guy, ... Offender information for the past 9 months (because it was illegal to ... offender was living on. ... enough reason to not charge him with assault. ...
    (alt.vacation.las-vegas)