Solved

how do I return an array from classic asp vbscript function

Posted on 2010-09-05
6
848 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 51

Expert Comment

by:Bill Prew
ID: 33608548
Try changing

return list

to

todayslist = list

~bp
0
 
LVL 51

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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 51

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 51

Expert Comment

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

~bp
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

13 Experts available now in Live!

Get 1:1 Help Now