![]() |
|
|
|||||||
![]() |
ASP Net - "name not declared" but it is |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 > > |
|
|
|
#3 |
|
Posts: n/a
|
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 > > |
|