Creating a Collection Variable ??

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: Creating a Collection Variable ??

    Not with VBScript, but you can use an Array to hold the elements.

    --
    Manohar Kamath
    Editor, .netBooks
    [url]www.dotnetbooks.com[/url]


    "Adam Knight" <aj.knight@optusnet.com.au> wrote in message
    news:e4jjhXYZDHA.2336@TK2MSFTNGP09.phx.gbl...
    > I have create a number of VB script classes. I want to add instances of
    > these classes to a variable to
    > create something resembling a collection. From their i will execute a for
    > each x in myinstances statement.
    >
    > Can anyone give some insight into how this may be accomplished in
    VBscript.
    >
    > AK
    >
    >

    Manohar Kamath [MVP] Guest

  2. Similar Questions and Discussions

    1. Persisting collection data of a webcontrol when leaving the collection editor in VS2005
      Hi folks, I'm developing a WebControl, that has got a property that's supposed to return a collection of data. Whenever I try to populate the...
    2. Creating variable using loop
      Ok the first part of my code has a loop that loops 1-5 then i want it to set session variables but i don't know how to go about doing this.. i want...
    3. Creating a panel with a collection property -- NEED HELP
      Hello everybody, I've been working lately on making my own tabstrip control because I couldn't find anything that works the way I want it. But now...
    4. Creating client variable
      I'm trying to lear out scope variables here but I'm having a hard time grasping the concept. I want to create a v take the quantity and unit price...
    5. Creating a new control collection
      I have an aspx page that has many nested controls. For example I have Panels that contain text boxes. There is also text boxes on the page itself....
  3. #2

    Default Re: Creating a Collection Variable ??



    Set tbl = New Site_Table

    tbl.Table_Align = "center"
    tbl.Table_Border = "0"
    tbl.Table_Width = "90%"
    tbl.Table_Name = "mail"
    tbl.Table_Data_Source = rs

    Session.Contents.Item("Table") = tbl

    If I do This: I get this error:

    Session object, ASP 0185 (0x80020003)
    A default property was not found for the object.
    /connect/admin/mail_table.inc, line 23


    If I do this:

    arrTable(0) = tbl

    I get this error:

    Microsoft VBScript runtime (0x800A01B6)
    Object doesn't support this property or method
    /connect/admin/mail_table.inc, line 16

    Can Anyone see another approach that will work !!!



    Adam Knight Guest

  4. #3

    Default Re: Creating a Collection Variable ??

    > Session.Contents.Item("Table") = tbl

    By using Session("Table") = tbl you are trying to store a
    value so it assumes you mean a property of tbl such as

    Session("Table") = tbl.Table_Name

    But as you did not provide a property (.something) it
    assumes you mean the default property, but you have not
    flagged anything as being the default property so it
    doesn't know what to add to the Session.

    If you want tbl itself stored, as an object, then you use
    Set

    Set Session("Table") = tbl

    Note, however, that you can't store VB Classes in the
    Session.

    Adrian Forbes - MVP Guest

  5. #4

    Default Re: Creating a Collection Variable ??

    Is their any way i can store vb classes in a variable so i can interate
    through it like a collection.

    Can it be done with an array some how ?

    AK


    Adam Knight Guest

  6. #5

    Default Re: Creating a Collection Variable ??

    Try a Scripting.Dictionary object.

    However, some of this thread shows an attempt to put the objects into a
    session variable. It is my understanding (could be wrong) that script
    objects cannot be stored in session variables and go out of scope when the
    ASP page ends.

    --
    Mark Schupp
    --
    Head of Development
    Integrity eLearning
    Online Learning Solutions Provider
    [email]mschupp@ielearning.com[/email]
    [url]http://www.ielearning.com[/url]
    714.637.9480 x17


    "Adam Knight" <aj.knight@optusnet.com.au> wrote in message
    news:e4jjhXYZDHA.2336@TK2MSFTNGP09.phx.gbl...
    > I have create a number of VB script classes. I want to add instances of
    > these classes to a variable to
    > create something resembling a collection. From their i will execute a for
    > each x in myinstances statement.
    >
    > Can anyone give some insight into how this may be accomplished in
    VBscript.
    >
    > AK
    >
    >

    Mark Schupp Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139