Your first example looks like ASP VBScript.
The second looks like ASP.Net VB.Net code.
In ASP.Net Request.Form(
item) returns a
NameValueCollection instead of the "array of strings" you got in ASP. In most cases there was only one occurrence of
item, so you simply got a string (
variant).
Since VB.Net has no
variant type you have to do explicit type coercion by invoking the ToString() method, and then further coerce the result by explicitly invoking ToInt() as well.
You can't use
Code:
Request.Form("betaid").ToInt()
because Request.Form
doesn't have a ToInt() method.
You use ToInt() because a VB.Net
integer is a VB
long, of course.
And just to drive me nuts, I can't find anything that claims a
string has a ToInt() method either!
Sucks, don't it?
So maybe
Code:
Request.Form("betaid").ToInt()
is
perfectly good - have you tried it? Suddenly I don't know 7/8 of what I thought I did!
The bathless hordes of C++ types who have driven Java and now C# and by extension VB.Net development seem to be all about making software development more labor intensive.
What cracks me up is their attempts like this at "elegance" when they have exceptions all over the place. You can still say
without having to code an explicit call on the Equals() method.
Sometimes I think they
are trying to kill off VB.