lydia_sp
16-09-2009, 17:12
hi.
I dared to check udt samples and worked out new one. so far I have understood this kind of udt :)
uses "console"
''one
type automobila
price(10) as variant
porsche as long
mercedes as string
ColourArray(10) as variant '- dont use long or integer !
end type
dim car as automobila
''two
type citycar
lupo as long
fiatpunto as string
minicooper as automobila
alfaromeo(20) as variant
x as long
end type
''three
dim lowerprice as citycar
car.price(1) = 1
car.price(2) = "30.487 Euro value"
car.price(3) = 3
car.price(4) = 4
car.price(5) = "102.976 Euro value"
car.price(6) = 6
car.price(7) = "9.999 Euro value"
msgbox 0, car.price(1) + $CRLF + car.price(2) + $CRLF + car.price(3) + $CRLF + car.price(4) + $CRLF + car.price(5) + $CRLF + car.price(6)+ $CRLF + car.price(7)
car.ColourArray(1) = "green"
car.ColourArray(2) = 2
car.ColourArray(3) = "blue"
car.ColourArray(4) = 3
car.ColourArray(5) = "silver"
car.ColourArray(6) = 4
msgbox 0, car.ColourArray(1) + $CRLF + car.ColourArray(2) + $CRLF + car.ColourArray(3) + $CRLF + car.ColourArray(4) + $CRLF + car.ColourArray(5) + $CRLF + car.ColourArray(6)
lowerprice.alfaromeo(1) = "alfa spider"
lowerprice.alfaromeo(2) = 2
lowerprice.alfaromeo(3) = "brero"
lowerprice.alfaromeo(4) = "alfa 159"
lowerprice.alfaromeo(5) = 5
lowerprice.alfaromeo(6) = "MiTo" : msgbox 0, "alfa romeo are no citycars and too expensive !"
msgbox 0, lowerprice.alfaromeo(1) + $CRLF + lowerprice.alfaromeo(2) + $CRLF + lowerprice.alfaromeo(3) + $CRLF + lowerprice.alfaromeo(4) + $CRLF + lowerprice.alfaromeo(5) + $CRLF + lowerprice.alfaromeo(6)
this example was needed to complete my canvas example :)
http://community.thinbasic.com/index.php?topic=2910.msg22125;topicseen#new
bye, Lydia
I dared to check udt samples and worked out new one. so far I have understood this kind of udt :)
uses "console"
''one
type automobila
price(10) as variant
porsche as long
mercedes as string
ColourArray(10) as variant '- dont use long or integer !
end type
dim car as automobila
''two
type citycar
lupo as long
fiatpunto as string
minicooper as automobila
alfaromeo(20) as variant
x as long
end type
''three
dim lowerprice as citycar
car.price(1) = 1
car.price(2) = "30.487 Euro value"
car.price(3) = 3
car.price(4) = 4
car.price(5) = "102.976 Euro value"
car.price(6) = 6
car.price(7) = "9.999 Euro value"
msgbox 0, car.price(1) + $CRLF + car.price(2) + $CRLF + car.price(3) + $CRLF + car.price(4) + $CRLF + car.price(5) + $CRLF + car.price(6)+ $CRLF + car.price(7)
car.ColourArray(1) = "green"
car.ColourArray(2) = 2
car.ColourArray(3) = "blue"
car.ColourArray(4) = 3
car.ColourArray(5) = "silver"
car.ColourArray(6) = 4
msgbox 0, car.ColourArray(1) + $CRLF + car.ColourArray(2) + $CRLF + car.ColourArray(3) + $CRLF + car.ColourArray(4) + $CRLF + car.ColourArray(5) + $CRLF + car.ColourArray(6)
lowerprice.alfaromeo(1) = "alfa spider"
lowerprice.alfaromeo(2) = 2
lowerprice.alfaromeo(3) = "brero"
lowerprice.alfaromeo(4) = "alfa 159"
lowerprice.alfaromeo(5) = 5
lowerprice.alfaromeo(6) = "MiTo" : msgbox 0, "alfa romeo are no citycars and too expensive !"
msgbox 0, lowerprice.alfaromeo(1) + $CRLF + lowerprice.alfaromeo(2) + $CRLF + lowerprice.alfaromeo(3) + $CRLF + lowerprice.alfaromeo(4) + $CRLF + lowerprice.alfaromeo(5) + $CRLF + lowerprice.alfaromeo(6)
this example was needed to complete my canvas example :)
http://community.thinbasic.com/index.php?topic=2910.msg22125;topicseen#new
bye, Lydia