## How to make a Collection

    ' Gambas class file

    col1 AS NEW Collection
    col2 AS NEW Collection

    PUBLIC SUB _new()
       col1.Add("hallo", 1)
       col1.Add(5.7,  2)
       col1.Add(876,  3)
       col1.Add(TRUE,  4)
       '----------------------------------------
       col2.Add("hallo", "a")
       col2.Add(5.7,  "b")
       col2.Add(876,  "c")
       col2.Add(TRUE,  "d")
    END

    PUBLIC SUB Button1_Click()
       ltxt AS String
       rtxt AS String
      '----------------------------------------
       IF IsString(col1[1]) THEN
        ltxt = ltxt & col1[1] & " is String<br>"
       ELSE
         ltxt = ltxt & col1[1] & " is no String<br>"
       ENDIF
       IF IsFloat(col1[2]) THEN
        ltxt = ltxt & col1[2] & " is Float<br>"
       ELSE
        ltxt = ltxt & col1[2] & " is no Float<br>"
       ENDIF
       IF IsInteger(col1[3]) THEN
        ltxt = ltxt & col1[3] & " is Integer<br>"
       ELSE
        ltxt = ltxt & col1[3] & " is no Integer<br>"
       ENDIF
          IF IsBoolean(col1[4]) THEN
        ltxt = ltxt & col1[4] & " is Boolean<br>"
       ELSE
        ltxt = ltxt & col1[4] & " is no Boolean<br>"
       ENDIF
       TextLabel1.Text= ltxt & col1.Count
      '----------------------------------------
        IF IsString(col2["a"]) THEN
         rtxt = rtxt & Str(col2["a"]) & " is String<br>"
        ELSE
          rtxt = rtxt & Str(col2["a"]) & " is no String<br>"
        ENDIF
        IF IsFloat(col2["b"]) THEN
         rtxt = rtxt & Str(col2["b"]) & " is Float<br>"
        ELSE
         rtxt = rtxt & Str(col2["b"]) & " is no Float<br>"
        ENDIF
        IF IsInteger(col2["c"]) THEN
         rtxt = rtxt & Str(col2["c"]) & " is Integer<br>"
        ELSE
         rtxt = rtxt & Str(col2["c"]) & " is no Integer<br>"
        ENDIF
           IF IsBoolean(col2["d"]) THEN
         rtxt = rtxt & Str(col2["d"]) & " is Boolean<br>"
        ELSE
         rtxt = rtxt & Str(col2["d"]) & " is no Boolean<br>"
        ENDIF
        TextLabel2.Text= rtxt & col2.Count
    END

-- JochenGeorges - 28 Dec 2004