Solved

how do I return an array from classic asp vbscript function

Posted on 2010-09-05
6
858 Views
Last Modified: 2012-05-10
hello EE warriors...

quick question.
How do I return an array from a VBScript function?

See code below:
Function todayslist

    Dim list(3)

    list(0) = "NBC Last Comic Standing"
    list(1) = "ABC Late Night with David Letterman"
    list(2) = "CBS Presidental Speech" 

    dim event1
    dim event2
    dim event3

    event1 = "NBC Last Comic Standing"
    event2 = "ABC Late Night with David Letterman"
    event3 = "CBS Presidental Speech"


    return list


End Function


    Dim todaysevents
    todaysevents = todayslist()
    if todaysevents.count > 0 Then
        Response.write("<ul>")
        For each Item in todaysevents
            Response.write("<li>" + Item)
        Next
        Response.write("/<ul>")
    end if

Open in new window

Function todayslist



    Dim list(3)



    list(0) = "NBC Last Comic Standing"

    list(1) = "ABC Late Night with David Letterman"

    list(2) = "CBS Presidental Speech" 



    dim event1

    dim event2

    dim event3



    event1 = "NBC Last Comic Standing"

    event2 = "ABC Late Night with David Letterman"

    event3 = "CBS Presidental Speech"





    return list





End Function





    Dim todaysevents

    todaysevents = todayslist()

    if todaysevents.count > 0 Then

        Response.write("<ul>")

        For each Item in todaysevents

            Response.write("<li>" + Item)

        Next

        Response.write("/<ul>")

    end if

Open in new window

0
Comment
Question by:Evan Cutler
  • 4
  • 2
6 Comments
 
LVL 52

Expert Comment

by:Bill Prew
ID: 33608548
Try changing

return list

to

todayslist = list

~bp
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 33608570
Try this.

~bp
Function todayslist
 
    Dim list(3)
 
    list(0) = "NBC Last Comic Standing"
    list(1) = "ABC Late Night with David Letterman"
    list(2) = "CBS Presidental Speech" 
 
    dim event1
    dim event2
    dim event3
 
    event1 = "NBC Last Comic Standing"
    event2 = "ABC Late Night with David Letterman"
    event3 = "CBS Presidental Speech"
 
    todayslist = list
 
End Function
 
    Dim todaysevents
    todaysevents = todayslist()
    if ubound(todaysevents) > 0 Then
        Response.write("<ul>")
        For each Item in todaysevents
            Response.write("<li>" + Item)
        Next
        Response.write("/<ul>")
    end if

Open in new window

0
 
LVL 9

Author Comment

by:Evan Cutler
ID: 33608589
nope.
says object required.

any other ideas?  :)


Thanks
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 52

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 33608600
In my second post, with the ubound() changes, you still got "object required"?

~bp
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
ID: 33608607
YOUR AWESOME

Thanks
Evan
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 33608619
Welcome.  Glad that helped, thanks.

~bp
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Connect MySql database to wordpress site 3 51
SQL to update characters in table column 6 82
get multiple images to align right 5 41
Remove lines by logo 2 21
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This video teaches users how to migrate an existing Wordpress website to a new domain.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now