473,569 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBScript class Q: Self-assignment of an object to a property from within the same class?

This is a semi-advanced question about ASP VBScript 5.0 classes. If you're
knowledegable, please lend a hand!

VBScript class instances can have properties that have objects assigned to
them. Borrowing R.Quinn's example from ASP101:

Public Property Get Authors()
if not isobject(m_Auth ors) then
set Library = New cLibrary
Call Library.GetAuth orsByBookID(Me. ID)
set m_Authors = Library.Authors
Set Library = nothing
end if
Set Authors = m_Authors
End Property

In this example, a collection of authors is assigned to property Authors by
calling an method of another class and using the "Set" keyword. This sort of
"external" loading of an object is characteristic of using the Set command.

I want to know if it is possible to assign a complex object to a property
without calling to an external class. For example, it would be elegant if I
could call a private GetAuthors method of the same class somehow (versus
using cLibrary), and pass the resulting object back to the Property.

Is this possible? Can someone get me started with the syntax of this?

Thanks.

-KF
Jul 22 '05 #1
3 4831
You have your three options to use with properties.

Property Get
Property Let
Property Set

I believe you are wanting the Property Set to pass the object in.

'dlbjr
'Pleading sagacious indoctrination!
Jul 22 '05 #2
Thanks, dlbjr, I know that part. What I'm wondering is if you can pass an
object generated from a private method that's in the same class, and perhaps
hoping that someone has an example of syntax for how you make that happen.

I've read contradictory things concerning whether this is even possible in
ASP VBScript.

-KF

"dlbjr" <oo**@iforgot.c om> wrote in message
news:On******** ******@TK2MSFTN GP14.phx.gbl...
You have your three options to use with properties.

Property Get
Property Let
Property Set

I believe you are wanting the Property Set to pass the object in.

'dlbjr
'Pleading sagacious indoctrination!

Jul 22 '05 #3
Here' s some code illustrating what I'm trying to do. I haven't tested it
yet, so I really don't know how this is going to work, nor do I know if it's
the best practice, but... The class name that I'm calling this from is
clsArticle - it briefly instantiates another instance to grab a value
generated by a method. In anyone knows whether this is "right", or if it's
gonna break, please let me know.

Public Property Get Authors()
if not isobject(m_Auth ors) then
set ArticleInstance = New clsArticle
' attemping to call this page's own GetAuthorsByArt icleID method by
instantiating another instance of clsArticle
Call ArticleInstance .GetAuthorsByAr ticleID(Me.ID)
set m_Authors = ArticleInstance .Authors
Set ArticleInstance = nothing
end if
Set Authors = m_Authors
End Property

<ke*****@u.wash ington.edu> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Thanks, dlbjr, I know that part. What I'm wondering is if you can pass an
object generated from a private method that's in the same class, and perhaps hoping that someone has an example of syntax for how you make that happen.

I've read contradictory things concerning whether this is even possible in
ASP VBScript.

-KF

"dlbjr" <oo**@iforgot.c om> wrote in message
news:On******** ******@TK2MSFTN GP14.phx.gbl...
You have your three options to use with properties.

Property Get
Property Let
Property Set

I believe you are wanting the Property Set to pass the object in.

'dlbjr
'Pleading sagacious indoctrination!


Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3435
by: Frank | last post by:
When I used IE 6.0 to view the ASP page on Window 2000 server PC, I encountered the error message: "Expected end of statement". The ASP page code is as: ****************************************************** <script language="VBScript"> function vb_Test(ptValue) vb_Test = ptValue end function
5
6817
by: John Davis | last post by:
When I create new documents in Dreamweaver, there are several choices for ASP creation: ASP JavaScript: run at client side?? ASP VBScript: run at server side?? ASP.NET C# ASP.NET VB I don't understand the differences between ASP JavaScript and ASP VBScript?? Because JavaScript is client-side technology, and ASP is server side technology....
29
5999
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
20
5955
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client javascript code and work out what it does but I can't really write it from scratch.
5
5189
by: gpence | last post by:
!!! Newbie question warning !!! I am somewhat familiar with javascript's ability to "access" the browser's favorites list -- for example, using window.home() will take you to the default URL -- is there any similar code for an ASP page using VBscript? I want my Logout button to take them back to their homepage. I've looked into...
5
2964
by: Ben Schumacher | last post by:
Has VbScript become obsolete in Asp.Net 2.0? I can't seem to find any documentation on using VbScript with Asp.Net 2.0. Does this mean that the three years of knowledge I have using VbScript is no longer usable and that I have to learn JavaScript/JScript? Converting and Asp 3.0 site, not only do I have to learn Vb.Net I also have to learn a...
4
2325
by: sparky | last post by:
I've been working on an ASP driven website, on a client's web hosting space. One of the project requirements was the ability for the client to be able to upload files through an HTTP form. No problem - I'd done plenty of that sort of thing before, but, to cut a long story short, my usual (component-less) upload scripts generated a multitude of...
6
1941
by: rishabhshrivastava | last post by:
Hello All, I am using ASP.NET 2.0 and I am experiencing a problem using vbscript that is this script on client side is preventing the postback of my controls. I have a dropdownlist which is supposed to perform some fucntion when the selected index is changed, it works fine without vbscript code(when i comment out that code) but when I...
8
5196
by: JRatcliff | last post by:
I know this is re-hashing this old problem, I have looked at almost all of the questions regarding this one, and the responces to this. BUT I need to find a solution that will work. BackGround I have a custom ASP.Net 2 app that will be going out to selective clients to use, and I have need to grab the screen size settings, (much as I do not...
2
8506
by: moodyman13 | last post by:
Hi All, I’m in a bit of pickle with ASP and VBscript variable and hope someone could get me some advice. There’s a FORM’ I’ve created in ASP and its purpose is to capture the name(s) of users. The plan is then to pass the information from ASP to VBScript. My dilemma is how to extract the information in ASP and use it in VBScript. (Please...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.