Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Custom Objects
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Custom Objects

 Post Reply Post Reply Page  12>
Author
Scott07 View Drop Down
Groupie
Groupie


Joined: 04 July 2002
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scott07 Quote  Post ReplyReply Direct Link To This Post Topic: Custom Objects
    Posted: 16 March 2005 at 9:02am
How do you create a custom object in asp like you would in java?  I have an asp file which I shall call my class file for an object how to I create an instance of that class file would I be able to do
<%
Dim objectBob
 
objectBob = Server.createobject("classes\bobclass.asp")
%>
 
and if that would work what do you call your constructure methods (the same as the page name?) or do they have to be called to initalise the object?
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2005 at 7:37pm
You do not do that in ASP.

If you want to use functions from another file you would use <!--#include file="../incfile.asp"-->

that will give you access to all the vars and functions in the file incFile.asp

Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2005 at 8:16pm
I think he's talking about COM objects.  Saw a great article/tutorial on how to do it, can't actually find it on Google anymore I'm affraid,  it's out there somewhere.
Back to Top
Scott07 View Drop Down
Groupie
Groupie


Joined: 04 July 2002
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scott07 Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2005 at 8:37am
Yeah I dont want to use an include because that puts the functions or what ever in the file what I am after is being able to create an object of some file that I have already made so for excample you could have
<%
Dim objCust1
Dim objCust2

set objCust1 = Server.CreateObject("somethingordorder")
set objCust2 = Server.CreateObject("somethingorother")

objCust1.AddToOrder(1234,1)
%>

with includes you can only use it once I bleieve so that AddToOrder call would change both customers but as objects have their own attributes the objCust1.AddToOrder call would only change the attributes for that object and not change the other. 
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2005 at 8:56am
Basically create the DLL in VB or whatever your making it in.

Register it on the server.

Create a new instance of it with the syntax you gave above.
Back to Top
Scott07 View Drop Down
Groupie
Groupie


Joined: 04 July 2002
Location: United Kingdom
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scott07 Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2005 at 9:33am
ahh great I though it was something like that but have just worked it out now.  Is there any way to test your objects as in making them do every access and update method before you register them? or you you register it make it crash cause its not right change code then update the dll file?
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2005 at 10:11am
When you save it as a DLL on your computer I think VB automatically registers it.  Otherwise you need to type regsv32 obj.dll or something like that on the server.

I found that if the object crashed I kept needing to reset IIS, or ctrl alt delete the dllhost.exe.
Back to Top
Meson View Drop Down
Newbie
Newbie
Avatar

Joined: 03 June 2003
Location: United States
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote Meson Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2005 at 1:05pm
You can create script components. You ewill find a tool to make them in Microsoft's scripting tools section or their site. Basically you create an xml file with speciallized object tags and embeded scripts.
 


Edited by Meson - 18 March 2005 at 1:10pm
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.