Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Problem with For loop in VBScript

Results 1 to 2 of 2
Share This Thread →
  1. #1
    Pavanlalit is offline Registered User
    Join Date
    Oct 2012
    Rep Power

    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>"
    Response.write "Not Equal"&"<br>"
    end if
    end if
    end if

  2. #2
    gk53's Avatar
    gk53 is offline Contributing User
    Join Date
    Mar 2005
    Columbus, OH
    Rep Power
    I think line '
    if(core_courseIndex(j)=ki) then

    should be

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

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Do without Loop error ???
    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

ASP Free Advertisers and Affiliates