Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 17th, 2004, 04:12 PM
Registered User
 
Join Date: Feb 2004
Location: , , Canada.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem understanding Object creation

I am in chapter 6 of the Beginning Active Server Pages 3.0 book. On page 229 it talks about creating objects.

I am having difficulty understanding the following line:

Set objTelephone = Server.CreateObject("MyTelephone.Telephone")

ObjTelephone is actually the variable that is holding the instance, correct?

I know that ("MyTelephone.Telephone") is the object ID. Can someone please explain to me what the first and second part of the object ID mean

Thanks!

Reply With Quote
  #2 (permalink)  
Old March 17th, 2004, 05:59 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Yes, objTelephone is the instance of the class.

When you create a class in a VB project, the project has a name. That class also has a name. Typically, what you are seeing is "<Projectname>.<Classname>".

You could create a project with many classes in it and potentially instantiate variable instances of any of those classes. For example: Microsoft's ADODB libaries have "ADODB.Connection" and "ADODB.Recordset".

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old March 17th, 2004, 10:19 PM
Registered User
 
Join Date: Feb 2004
Location: , , Canada.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok,

I think that I understand it now – thanks Peter! So if I understand this the first part of the object name (in this case) is MyTelephone. This is happens to be the name of the DLL – the object. So am I calling/creating an instance of that object (MyTelephone.dll) with a class of telephone.

Am I even close????????

When you install these objects are you given the list of the Properties, methods and events names and all that entails?

Yes I am totally new to programming.


Reply With Quote
  #4 (permalink)  
Old March 18th, 2004, 02:26 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The dll is not an object (not programmatically anyway). It's a library or collection of classes. Think of "MyTelephone" as the library name. You need to create an object by instantiating one of the classes within the library. So in the example in your first post, you are creating an object that is an instance of the class "Telephone" from the library "MyTelephone".

As far as getting documentation, that's up to the provider of the library. You could very likely get a library that doesn't have a bit of documentation. But it's kind of hard to use such a beast. When you are working in a development environment that supports Intellisense, you will usually get a list of properties and methods (collectively known as "Members") of a class when you hit the period after the instance variable name of the class. Here's an example. In your development environment, such as Visual Studio you type the following to create an instance of a class from the library.
Code:
Dim objTelephone
Set objTelephone = Server.CreateObject("MyTelephone.Telephone")
objTelephone.|
At the end of "objTelephone." (where the pipe symbol is representing the cursor) you would get a little list box that pops up and shows you all the publicly accessible members of that class. When you choose a function, you'll usually get a tooltip with the function signature so you can see what you need to pass into the function to make it work.

Without these helpful features, you have to rely on documentation to know what members of a class are available and how to use them.

Hope that clarifies things a bit.

Peter
Reply With Quote
  #5 (permalink)  
Old March 18th, 2004, 07:04 PM
Registered User
 
Join Date: Feb 2004
Location: , , Canada.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Peter!!!!!!

That certainly cleared up things for me!
It really helps being placed in a position to see a situation from a different prospective.

Cheers!!!!


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in understanding EnsureValidSortExp syntax dazy BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 January 25th, 2008 04:49 PM
submitting form - object creation timing forumuser BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 December 3rd, 2007 02:59 PM
problem in XMlserialization understanding. Theone84 ASP.NET 2.0 Professional 1 August 26th, 2007 02:20 PM
Problem understanding how to arrange the project alexanderH BOOK: ASP.NET Website Programming Problem-Design-Solution 6 January 29th, 2007 12:50 AM
Basic OOPS..invariant and object creation kaspyanand C# 2 May 24th, 2006 07:04 PM



All times are GMT -4. The time now is 07:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.