473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Classes & Collections and some related issue

Hello,

I want to implement a class structure that can take a querystring and the
value of querysting can be called as myClass.getQuery("test").value. I know
that I can do it like myClass.getQuery("test") and get the value of "test"
querystring. But actually, this is an example only. In order to my class
library organized I need a structure like this.

I search internet and documents for ASP and Vbscript, as far as I found is
that in Vbscript, we are allowed to use nested classes and creating
collection object. I tried to run Vbscript examples in an ASP page, I only
get syntax error at where a nested class or collection object is declared. I
also try to learn about creating collection my own collection objects in ASP
because I try to have a function in my Class that returns a collection
object.

My question is a bit confusing, but I am confused too. I will be gratefull
for any help or ideas and information.

Here is the as far as I can go :

Class myClass
Private Sub Class_Initialize()
End Sub

Public Function getQuery(strQuery)
' Here I didn't want to get the query value with the function itself.
' I want to get it as myClass.getQuery("test").value
' I can declare a property to give the value as queryvalue
' But it doesnt help to me because when I do that,
' I can get value as myClass.queryvalue

getQuery = request.querystring(strQuery)

End Function

Private Sub Class_Terminate()
End Sub
End Class
Thank You,

Ugur Aslan
http://www.uguraslan.net

Apr 2 '06 #1
9 1769

"Ugur ASLAN" <ugur(at)uguraslan.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello,

I want to implement a class structure that can take a querystring and the
value of querysting can be called as myClass.getQuery("test").value. I
know
that I can do it like myClass.getQuery("test") and get the value of "test"
querystring. But actually, this is an example only. In order to my class
library organized I need a structure like this.
why do youneed the .value?

its just not how vb is structured

I search internet and documents for ASP and Vbscript, as far as I found is
that in Vbscript, we are allowed to use nested classes and creating
collection object. I tried to run Vbscript examples in an ASP page, I only
get syntax error at where a nested class or collection object is declared.
I
also try to learn about creating collection my own collection objects in
ASP
because I try to have a function in my Class that returns a collection
object.

My question is a bit confusing, but I am confused too. I will be gratefull
for any help or ideas and information.

Here is the as far as I can go :

Class myClass
Private Sub Class_Initialize()
End Sub

Public Function getQuery(strQuery)
' Here I didn't want to get the query value with the function itself.
' I want to get it as myClass.getQuery("test").value
' I can declare a property to give the value as queryvalue
' But it doesnt help to me because when I do that,
' I can get value as myClass.queryvalue

getQuery = request.querystring(strQuery)

End Function

Private Sub Class_Terminate()
End Sub
End Class
Thank You,

Ugur Aslan
http://www.uguraslan.net

Apr 2 '06 #2

"Slim" <me@here.com> wrote in message
news:Oo**************@tk2msftngp13.phx.gbl...


why do youneed the .value?
Actually I do not need .value. It is just an example. I need more confused
thing that I dont want to confuse my question with unnecessary details about
my project. If I can do, the .value thing, I can do more confusing stuff on
my own.
its just not how vb is structured


In vbscript you can do that. so it is just how vb is structured. You can use
nested class in Vbscript, also your functions can return collections. So use
can use .value thing. But I cannot do in ASP. The only thing that I wonder
is whether or not it is possible to do as I described. If no why? If yes
how?

For example in an ASP page:

Set fs = server.createobject("Scripting.FileSystemObject")
set folders = fs.getfolder("C:\").subfolders

is ok. fs.getFolder("C:\").subfolders...


Here is the as far as I can go :

Class myClass
Private Sub Class_Initialize()
End Sub

Public Function getQuery(strQuery)
' Here I didn't want to get the query value with the function itself.
' I want to get it as myClass.getQuery("test").value
' I can declare a property to give the value as queryvalue
' But it doesnt help to me because when I do that,
' I can get value as myClass.queryvalue

getQuery = request.querystring(strQuery)

End Function

Private Sub Class_Terminate()
End Sub
End Class
Thank You,

Ugur Aslan
http://www.uguraslan.net


Apr 2 '06 #3



Here is the as far as I can go :

Class myClass
Private Sub Class_Initialize()
End Sub

Public Function getQuery(strQuery)
' Here I didn't want to get the query value with the function itself. ' I want to get it as myClass.getQuery("test").value
' I can declare a property to give the value as queryvalue
' But it doesnt help to me because when I do that,
' I can get value as myClass.queryvalue

getQuery = request.querystring(strQuery)

End Function

Private Sub Class_Terminate()
End Sub
End Class
Thank You,

Ugur Aslan
http://www.uguraslan.net

Problem is without explaining your reasons it's difficult to give you an
answer.
Here is another shot in the dark:-

Would you be happy with .Item instead of .Value?

Public Function getQuery(strQuery)
Set getQuery = Request.QueryString(strQuery)
End Function

This would require code like this o retrieve a value:-

x = myClass.getQuery("test").item

..
Yet another shot would be:-
Class QueryValue

moQueryValue

Public Sub Init(Value)
Set moQueryValue = Value
End Sub

Public Property Get Value()
Dim tmp
' Code munging moQueryValue to extract something into tmp
Value = tmp
End Property
End Class
Then in your original class:-

Public Function getQuery(strQuery)
Set getQuery= New QueryValue
getQuery.Init Request.QueryString(strQuery)
End Function
Any of this help?
Anthony.
Apr 2 '06 #4
Hi again,

Thank you for you examples, actually they helped me to see the solution of
my problem in another way.

Let me tell the full story then maybe you would like to help me a bit more.

I developed an ecommerce web site, with a tidy structure, all the work is
done in separate functions and subs. Almost there is no "spagetti code" that
are written between HTML tags. I like it very much and I want this web
application to be object oriented as far as ASP allows.

I planned the how to all functions, sub, data structures organize and how I
call all classes, how I will pass parameters. The only thing that I did
wrong is that I thought I can use nested classes and collection objects in
ASP. I still don't know if I can or not.

I divided all functions and subs into logical categories. I thought that
there would be one class for handling all the jobs. And I thought that I
could use such structures:

ecommerce.setDatabaseConfiguration(some parameters)
ecommerce.setSessions()

and also

ecommerce.payment.checkCreditCard(some parameters)
ecommerce.users.getUsername(some userID)

Here ecommerce.payment would not do anything without a method or property
specified. payment, users would only be used to write ASP easily understand
and to class library be more organized.

But I can go no further, when I cannot use nested classes and collections. I
searched internet, documents but I could not found any advanced information
in classes in ASP and its limitations.

So the question is now, can it be possible to implement such a class
structure in ASP. Any workaround is available?

Thanks,

Ugur Aslan
http://www.uguraslan.net

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...

Problem is without explaining your reasons it's difficult to give you an
answer.
Here is another shot in the dark:-

Would you be happy with .Item instead of .Value?

Public Function getQuery(strQuery)
Set getQuery = Request.QueryString(strQuery)
End Function

This would require code like this o retrieve a value:-

x = myClass.getQuery("test").item

.
Yet another shot would be:-
Class QueryValue

moQueryValue

Public Sub Init(Value)
Set moQueryValue = Value
End Sub

Public Property Get Value()
Dim tmp
' Code munging moQueryValue to extract something into tmp
Value = tmp
End Property
End Class
Then in your original class:-

Public Function getQuery(strQuery)
Set getQuery= New QueryValue
getQuery.Init Request.QueryString(strQuery)
End Function
Any of this help?
Anthony.

Apr 2 '06 #5
the answer is yes

"Ugur ASLAN" <ugur(at)uguraslan.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi again,

Thank you for you examples, actually they helped me to see the solution of
my problem in another way.

Let me tell the full story then maybe you would like to help me a bit
more.

I developed an ecommerce web site, with a tidy structure, all the work is
done in separate functions and subs. Almost there is no "spagetti code"
that
are written between HTML tags. I like it very much and I want this web
application to be object oriented as far as ASP allows.

I planned the how to all functions, sub, data structures organize and how
I
call all classes, how I will pass parameters. The only thing that I did
wrong is that I thought I can use nested classes and collection objects
in
ASP. I still don't know if I can or not.

I divided all functions and subs into logical categories. I thought that
there would be one class for handling all the jobs. And I thought that I
could use such structures:

ecommerce.setDatabaseConfiguration(some parameters)
ecommerce.setSessions()

and also

ecommerce.payment.checkCreditCard(some parameters)
ecommerce.users.getUsername(some userID)

Here ecommerce.payment would not do anything without a method or property
specified. payment, users would only be used to write ASP easily
understand
and to class library be more organized.

But I can go no further, when I cannot use nested classes and collections.
I
searched internet, documents but I could not found any advanced
information
in classes in ASP and its limitations.

So the question is now, can it be possible to implement such a class
structure in ASP. Any workaround is available?

Thanks,

Ugur Aslan
http://www.uguraslan.net

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...

Problem is without explaining your reasons it's difficult to give you an
answer.
Here is another shot in the dark:-

Would you be happy with .Item instead of .Value?

Public Function getQuery(strQuery)
Set getQuery = Request.QueryString(strQuery)
End Function

This would require code like this o retrieve a value:-

x = myClass.getQuery("test").item

.
Yet another shot would be:-
Class QueryValue

moQueryValue

Public Sub Init(Value)
Set moQueryValue = Value
End Sub

Public Property Get Value()
Dim tmp
' Code munging moQueryValue to extract something into tmp
Value = tmp
End Property
End Class
Then in your original class:-

Public Function getQuery(strQuery)
Set getQuery= New QueryValue
getQuery.Init Request.QueryString(strQuery)
End Function
Any of this help?
Anthony.


Apr 3 '06 #6

">
But I can go no further, when I cannot use nested classes and collections. I searched internet, documents but I could not found any advanced information in classes in ASP and its limitations.

So the question is now, can it be possible to implement such a class
structure in ASP. Any workaround is available?


If by nested classes you mean this:-

Class COuter

Class CInner
Public Property Get Value()
Value = "Hello World"
End Property
End Class
Public Property Get Inner()
Set Inner = New CInner
End Property

End Class

Dim o

Set o = New COuter

Response.Write o.Inner.Value

Then No that is a syntax error but I believe I've already demonstrated the
work around:-


Class CInner
Public Property Get Value()
Value = "Hello World"
End Property
End Class

Class COuter

Public Property Get Inner()
Set Inner = New CInner
End Property

End Class

Dim o

Set o = New COuter

Response.Write o.Inner.Value

Anthony.
Apr 3 '06 #7
Thank you so much for information-rich answer

"Slim" <me@here.com> wrote in message
news:eH**************@TK2MSFTNGP11.phx.gbl...
the answer is yes

Apr 3 '06 #8
Thank you for your explaination. I got the idea. Your code helped me a lot.
Now, I can go on further details on my own.

Ugur Aslan
http://www.uguraslan.net

"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:#N**************@TK2MSFTNGP11.phx.gbl...

">
But I can go no further, when I cannot use nested classes and
collections. I
searched internet, documents but I could not found any advanced

information
in classes in ASP and its limitations.

So the question is now, can it be possible to implement such a class
structure in ASP. Any workaround is available?


If by nested classes you mean this:-

Class COuter

Class CInner
Public Property Get Value()
Value = "Hello World"
End Property
End Class
Public Property Get Inner()
Set Inner = New CInner
End Property

End Class

Dim o

Set o = New COuter

Response.Write o.Inner.Value

Then No that is a syntax error but I believe I've already demonstrated the
work around:-


Class CInner
Public Property Get Value()
Value = "Hello World"
End Property
End Class

Class COuter

Public Property Get Inner()
Set Inner = New CInner
End Property

End Class

Dim o

Set o = New COuter

Response.Write o.Inner.Value

Anthony.

Apr 3 '06 #9

"Ugur ASLAN" <ugur(at)uguraslan.net> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
Thank you so much for information-rich answer
no worries its easy when you get a clear unambiguous question

"Slim" <me@here.com> wrote in message
news:eH**************@TK2MSFTNGP11.phx.gbl...
the answer is yes


Apr 5 '06 #10

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

Similar topics

18
by: vrillusions | last post by:
I've been using functions since I first started using php, but I've been hearing more and more about classes, which I never really looked at that much. I understand the whole OO programming...
9
by: Pierre Barbier de Reuille | last post by:
Ok, I first want to stress that I looked through the newsgroups archives (on Google) for an answer to my question, but I didn't find it. It's about the interface of the set classes as defined in...
9
by: Aguilar, James | last post by:
I know that one can define an essentially unlimited number of classes in a file. And one can declare just as many in a header file. However, the question I have is, should I? Suppose that, to...
2
by: Marc | last post by:
Given a class 'Invoice' with a property 'public IMyColl<IInvoiceLine> InvoiceLines' where 'IMyColl<T> : IList<T>' i would like to detect by reflection that 'InvoiceLines' is a...
0
by: Ewart MacLucas | last post by:
generated some WMI managed classes using the downloadable extensions for vs2003 from mircrosoft downloads; wrote some test code to enumerate the physicall processors and it works a treat, but a...
3
by: Paul | last post by:
Hello, I'm upgrading a small single user app to VB.NET and have a few questions about loading classes & collections classes with the data from a one to many dataset structure. I'm serializing...
1
by: Blip | last post by:
I am still struggling with a pattern that can be used to move data from a class to a related form, and from the class method results to text boxes, listboxes, etc on the form. I usually get it...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
45
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.