473,508 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Objects and collections

I have two questions which I am unable to find answers to:

1. What is the difference between Request.Form and Request.Item?

I can do this:

dim obj, postback, o
postback = Request.Form("postback")
if postback <> "" then
for each obj in Request.Form
o = Request.Item(obj)
if o <> "postback" then
session(obj) = o
end if
Response.Write session(obj) & "<br />" & vbCrLf
next
end if

What makes Request.Item different in this respect than Request.Form? Is
there a benefit one way or the other?

2. Is it possible to use FOR...EACH, with a form and make the variable an
object?

Ex.

If I use:
for each obj in Request.Form

obj is not an object as I cannot then write:

Response.Write obj.value to get the value of the form variable.

If my form was:

<input type="text" name="iname" value="" />

and I typed in Roland and submitted, I cannot with the FOR...EACH use
obj.value to get the value. Is there a way to do it that I am not aware of?

TIA...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #1
4 2152
Roland Hall wrote:
I have two questions which I am unable to find answers to:

1. What is the difference between Request.Form and Request.Item?
Request.Item(something) is the same as Request(something). Basically, Item
is the default property, and you've requested the first itme in all the
Request object's collections whose key matches your specification
What makes Request.Item different in this respect than Request.Form?
Is there a benefit one way or the other?
I'm sure you've read all our admonitions in the past about failing to
specify the collection whose item you wish to retrieve...

2. Is it possible to use FOR...EACH, with a form and make the
variable an object?


for each key in Request.Form
Response.Write key & ": " & Response.Form(key)
next

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
"Bob Barrows [MVP]" wrote in message
news:OX**************@tk2msftngp13.phx.gbl...
: Roland Hall wrote:
: > I have two questions which I am unable to find answers to:
: >
: > 1. What is the difference between Request.Form and Request.Item?
:
: Request.Item(something) is the same as Request(something). Basically, Item
: is the default property, and you've requested the first itme in all the
: Request object's collections whose key matches your specification
:
: > What makes Request.Item different in this respect than Request.Form?
: > Is there a benefit one way or the other?
:
: I'm sure you've read all our admonitions in the past about failing to
: specify the collection whose item you wish to retrieve...
:
: >
: > 2. Is it possible to use FOR...EACH, with a form and make the
: > variable an object?
:
: for each key in Request.Form
: Response.Write key & ": " & Response.Form(key)
: next

key is the form element
Response.Form(key) would return the value but how can I make key an object
and use key.value to get the value?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #3
Roland Hall wrote:
2. Is it possible to use FOR...EACH, with a form and make the
variable an object?
for each key in Request.Form
Response.Write key & ": " & Response.Form(key)
next


key is the form element


Actually, it is the key of the form element
Response.Form(key) would return the value but how can I make key an
object and use key.value to get the value?


Unfortunately, the vbscript enumerator does not work that way with these
collections. The enumerator exposes the item keys, not the items themselves.
It took me a while to figure this out, so I feel your pain.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #4
"Bob Barrows [MVP]" wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
: Roland Hall wrote:
:
: >>> 2. Is it possible to use FOR...EACH, with a form and make the
: >>> variable an object?
: >>
: >> for each key in Request.Form
: >> Response.Write key & ": " & Response.Form(key)
: >> next
: >
: > key is the form element
:
: Actually, it is the key of the form element

Ah, ok.

: > Response.Form(key) would return the value but how can I make key an
: > object and use key.value to get the value?
: >
:
: Unfortunately, the vbscript enumerator does not work that way with these
: collections. The enumerator exposes the item keys, not the items
themselves.
: It took me a while to figure this out, so I feel your pain.

That's unfortunate. Well good for me that I have you to provide that answer
so my insanity will not come from trying to figure this one out. Thanks
Bob.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #5

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

Similar topics

11
1750
by: thechaosengine | last post by:
Hi all, I have a very general but quite significant question about objects. My question is, when should I create them? I know thats a crap question so let me explain a bit further. Lets...
3
1290
by: Guy Dillen | last post by:
Instead of using DataSets i want to implement an objects collection (in C#). E.g. a class Person and the instances are stored in a collection of Persons. So there is a layer that does the database...
13
1121
by: Ioannis Vranos | last post by:
So to be more excited, will it be possible to use standard library containers with handles in VC++ 2005/.NET 2.0 era? Like this: vector<Button ^>buttonArray;
3
1714
by: Rob Thomas | last post by:
Hi, I've been tasked to come up with a new architecture for a large application at one of my customer's sites. In the past, I have developed multi-tier applications whereby the business...
2
1133
by: Terry | last post by:
What is the syntax for referencing the properties of objects within Collections of objects? EXAMPLE: Dim MCoil As New Coil MCoil = CoilCollection("3456") TextBox1.Text() = MCoil.CoilDesc ...
6
1239
by: Dave J | last post by:
I’m in need of some remedial instruction collections of objects. I doubt if this question is specific to pocket pc and VB, but that’s where I’m coding. When I create a collection, call it...
21
2190
by: George Exarchakos | last post by:
Hi everyone, I'd like your help... Can we have a std::list<BASEwhere BASE be the base class of a class hierarchy? I want to add to this list objects that are inherited from BASE class but not...
1
2129
by: DesperateDan | last post by:
I've got a parent object that is a collection and it in turn is hosting 2 child objects. My searlization has worked perfectly to plan in as much that I wanted to dictate the names of the objects...
28
1569
by: walterbyrd | last post by:
Python seems to have a log of ways to do collections of arbitrary objects: lists, tuples, dictionaries. But what if I want a collection of non-arbitrary objects? A list of records, or something...
1
1245
by: =?Utf-8?B?a2thcnJl?= | last post by:
Hi all, We decided to clear the test db more frequently and I was asked to serialize som test objects to make sure our unit testing continues to work after clearing the db. Does anyone have...
0
7229
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,...
0
7129
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...
0
7398
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...
1
7061
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...
1
5057
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...
0
4716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3208
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...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1566
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 ...

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.