Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how do I return an array from classic asp vbscript function

Posted on 2010-09-05
6
Medium Priority
?
1,078 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 58

Expert Comment

by:Bill Prew
ID: 33608548
Try changing

return list

to

todayslist = list

~bp
0
 
LVL 58

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
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
LVL 58

Accepted Solution

by:
Bill Prew earned 2000 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 58

Expert Comment

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

~bp
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

636 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