[Gambas-devel] Empty string sets controls and collections members to null Question
richard terry
rterry at ...627...
Mon Nov 23 03:32:36 CET 2009
On Thursday 27 August 2009 19:55:01 you wrote:
I asked this before (text below) and to my recollection (maybe faulty) Benoit
said that the behaviour causing me problems was normal, however I really need
to find a solution.
In a nutshell again it is this:
I use collections to transfer data to-from my database to add/update records
(don't use the gambas datacontrol).
If an existing collection has a member containing text eg
MyCollection!my_value = "a dog", and I'm updating the record, lets say I've
deleted the text in the input field, and the value in the backend for that
field in a table now has to be an empty sting or null, if I do this:
MyCollectioni!my_value = "", effectively removes the 'my_value' key from the
collection, dosn't set its string to null.
I would have thought that "" = empty string, not null, but I think Benoit said
that this was equivalent in gambas. I can't think how to get around this and
wondered if anyone could think of a solution.
Regards
Richard
> 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
>
More information about the Devel
mailing list