\' Gambas class file
Public Sub Form_Open()
Dim a As Integer
Dim c As New MejoraColeccion
Dim c2 As New MejoraColeccion
c.Add("hace mucho calor", "Sol")
c.Add("esta muy cerca del sol", "Mercurio")
c.Add("En su atmosfera no se puede respirar por el efecto invernadero", "Venus")
c.Add("Es el planeta azul... aunque cada vez es mas gris", "Tierra")
c.Add("Mas pequeño que la tierra, rojo y bastante ventoso", "Marte")
Print c[0]
Print c[4]
c.add("muy grande, y con una mancha roja", "Jupiter")
Print c.Count
Print c[c.count - 1]
Print c.Key(c.count - 1)
Print c["Jupiter"]
TextAreaContenido.text &= "--------------------------------------------------------" & gb.CrLf
TextAreaContenido.text &= "Recorrer Colección como si fuera un array c " & gb.CrLf
TextAreaContenido.text &= "--------------------------------------------------------" & gb.CrLf
For a = 0 To c.count - 1
Print "Key:", c.Key(a), "Contenido:", c[a]
TextAreaContenido.text &= "Key: " & c.Key(a) & ", Contenido: " & c[a] & gb.CrLf
Next
\'añado un valor mas a una copia
c2 = c.Copy()
c2.add("El señor de los Anillos...", "Saturno")
TextAreaContenido.text &= "--------------------------------------------------------" & gb.CrLf
TextAreaContenido.text &= "Recorrer Colección como si fuera un array c " & gb.CrLf
TextAreaContenido.text &= "--------------------------------------------------------" & gb.CrLf
For a = 0 To c.count - 1
Print "Key:", c.Key(a), "Contenido:", c[a]
TextAreaContenido.text &= "Key: " & c.Key(a) & ", Contenido: " & c[a] & gb.CrLf
Next
TextAreaContenido.text &= "**** Copia alterada ****" & gb.CrLf
TextAreaContenido.text &= "--------------------------------------------------------" & gb.CrLf
TextAreaContenido.text &= "Recorrer Colección como si fuera un array c2 " & gb.CrLf
TextAreaContenido.text &= "--------------------------------------------------------" & gb.CrLf
For a = 0 To c2.count - 1
Print "Key:", c2.Key(a), "Contenido:", c2[a]
TextAreaContenido.text &= "Key: " & c2.Key(a) & ", Contenido: " & c2[a] & gb.CrLf
Next
Print c2["Jupiter"]
End
Public Sub Form_Resize()
TextAreaContenido.w = Me.w - TextAreaContenido.y - 10
TextAreaContenido.h = Me.h - 20 - TextAreaContenido.y
End