Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Variables to new objects

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi There

Up until now I've primarily done OOP programming in PHP. Now I'm trying to get something similar in ASP. Basically I'm trying to do a templating thing in ASP where I have all the data for a survey (question text, type, possible answers, etc) in a DB, and Iwant to create a question object that, when instantiated gets all the info out of the database automatically. The thing is in PHP I could instantiate a new object and pass a variable (i.e. the questions number). Then the Initialize event would take this variable (question number) and use it to pull all the properties of that question out of the database and populate the object's variables with those values. Obviously I can do this with a function that's not an initialize event (setting a private variable to the question numbe,r then calling a function that references that internal variable), but then I'd have to make sure I always called it after instantiating the object - I want it to do it automatically as soon as the new object is declared.

I hope this makes sense...

Ben
 
I would use VB.NET/SP.NET if I had the choice, which I do, thank God. Each class has a NEW (constructor) method that takes parameters. VB.Net can be written to run under the ASP.NET environment. There is no VB script. Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top