#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2012
    Posts
    14
    Rep Power
    0

    Exclamation Problem with For loop in VBScript


    Hi all,

    I have a code that checks for following logic in VBScript

    One array holds the Index number of which should not be displayed in page.

    The Second Array is a general Array with few data.

    Now I want to display only those elements that are not having the Index sepcified in first array.

    for eg:- if one array has 2,3,6,8 as prohibited indexes, the the second array should display data at indexes 1,4,5,7,9... I have formulated the logic as follows but I observe the first loop variable 'ki' takes the upperbound of array.i.e it executes only the first statement in loop and then it executes the remaining by looping in, I am lost by this weird behaviour. Can Anyone solve this issue or justify this? I have posted the code for your reference...

    for ki=0 to UBound(elec_course_grade)
    if(elec_course_grade(ki)<>"") then
    for j=0 to UBound(core_courseIndex)
    if(core_courseIndex(j)<>"") then
    Response.write "comparing.."&core_courseindex(j)&" and "&ki&"<br>"
    if(core_courseIndex(j)=ki) then
    Response.write " Match found in array"&core_courseIndex(j)&" value of ki="&ki&"<br>"
    else
    Response.write "Not Equal"&"<br>"
    end if
    end if
    Next
    end if
    Next
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,581
    Rep Power
    278
    I think line '
    if(core_courseIndex(j)=ki) then

    should be

    if(core_courseIndex(j)=elec_course_grade(ki)) then
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

Similar Threads

  1. Do without Loop error ??? ASP.net/vbscript
    By apporter in forum .NET Development
    Replies: 1
    Last Post: February 22nd, 2008, 06:26 AM
  2. Basic VBScript Class Loop determine biggest and smallest!
    By kmtiburona in forum Windows Scripting
    Replies: 3
    Last Post: November 20th, 2007, 08:40 AM
  3. loop-de-loop problem
    By david_918891 in forum ASP Development
    Replies: 1
    Last Post: March 9th, 2005, 02:41 PM
  4. Loop problem or Select statement problem?
    By ap390 in forum ASP Development
    Replies: 3
    Last Post: October 20th, 2004, 09:09 AM
  5. Problem with loop
    By ProEdge in forum .NET Development
    Replies: 25
    Last Post: August 24th, 2004, 10:16 PM

IMN logo majestic logo threadwatch logo seochat tools logo