Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - "name not declared" but it is

 
Thread Tools Search this Thread
Old 02-03-2004, 10:24 PM   #1
Default "name not declared" but it is


it says the name is not declared, but it is
how can I fix this ?

Compiler Error Message: BC30451: Name 'arrReportsList' is not declared.


==========================
if Len(request.querystring("rpt")) > 0 then
Dim arrReportsList =split(request.querystring("rpt"),",")
else
Dim arrReportsList =split(Session("rpt"),",")
end if

vPagecount = Ubound(arrReportsList) + 1 '<== error on this line




TJS
  Reply With Quote
Old 02-03-2004, 10:39 PM   #2
Hermit Dave
 
Posts: n/a
Default Re: "name not declared" but it is

the reason is that you are defining a variable local to that block
ie the variable arrReportList is local to your if or else block

try something like this
Dim arrReportList (not sure how you do it in VB but in c# you would do it
this way string[] arrReportList
if Len(request.querystring("rpt")) > 0 then
arrReportsList =split(request.querystring("rpt"),",")
else
Dim arrReportsList =split(Session("rpt"),",")
end if

vPagecount = Ubound(arrReportsList) + 1 '<== error on this line

Should be fine now... hth

--
Regards,
HD
Once a Geek.... Always a Geek
"TJS" <> wrote in message
news:%...
> it says the name is not declared, but it is
> how can I fix this ?
>
> Compiler Error Message: BC30451: Name 'arrReportsList' is not declared.
>
>
> ==========================
> if Len(request.querystring("rpt")) > 0 then
> Dim arrReportsList =split(request.querystring("rpt"),",")
> else
> Dim arrReportsList =split(Session("rpt"),",")
> end if
>
> vPagecount = Ubound(arrReportsList) + 1 '<== error on this line
>
>



  Reply With Quote
Old 02-03-2004, 10:47 PM   #3
vMike
 
Posts: n/a
Default Re: "name not declared" but it is

You have to declare the type.

Dim arrReportsList as string()

I would declare it before the if statement and then set it in the if
statement

arrReportsList = split(request.querystring("rpt"),",")

"TJS" <> wrote in message
news:%...
> it says the name is not declared, but it is
> how can I fix this ?
>
> Compiler Error Message: BC30451: Name 'arrReportsList' is not declared.
>
>
> ==========================
> if Len(request.querystring("rpt")) > 0 then
> Dim arrReportsList =split(request.querystring("rpt"),",")
> else
> Dim arrReportsList =split(Session("rpt"),",")
> end if
>
> vPagecount = Ubound(arrReportsList) + 1 '<== error on this line
>
>



  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump