[Gambas-user] Empty string sets controls and collections members to null Question

Benoît Minisini gambas at ...1...
Sat Aug 29 14:37:44 CEST 2009


> This question is really around how to set a collection member to an empty
> string without destroying it.
>
>
> I've noticed (forever) that this code
>
> textbox1 = "" when one accidentally forgot to write
>
> textbox1.text ="", actually sets the control to null.
>
> But I've also I just noticed this:
>
>
> Lets say you have a collection
>
> dim aCollection  as new collection
>
> aCollection!value = "hi there"
>
> is a valid statement
>
> aCollection.Remove("value") -  removes the item
>
> aCollecton!value = ""  actually works like  aCollection.Remove("value")
>
> which is sort of inconvenient if you want the collection member to be an
> empty string
>
> Am I wrong ?any suggestions/observations.
>
> regards
>
> richard
>

You can't do what you want. There is no difference between NULL and an empty 
string in Gambas, and so putting a void string inside a Collection is the same 
thing as removing the element.

Regards,

-- 
Benoît




More information about the User mailing list