Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBox, ADO and NULL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00571449
Message ID:
00571543
Vues:
21
This message has been marked as the solution to the initial question of the thread.
Hi!

Combobox originally made to work with the character values. However, when numeric value asisgnen to the Value property, order number of item in the combobox is used as a source. This means that Value property will contain the same value as ListIndex. It looks like as soon as combobox see the .NULL. value, it think it is character and as a reult does not works.

It is recommended in such case add some additional code to the listbox and do not bind it using ControlSource. However, because you already have a project that use combobox a lot, following is a workaround for such case:

(suggesting your combobox is a class that you use on forms)
In the Init event of the combobox store ControlSource property value into the custom new property in the combobox class, then clear it. In the Refresh event read value of the field using EVALUATE() function that will evaluate expression - control source from custom property, and assign result to the Value property. After change use Valid event to assign just selected value back to the field. You can use for this "&" :

m.lc____STR=this.StoredControlSource
&lc____STR = this.Value

HTH.

>Hi,
>
>I develop a class wrapper for ado. This because i need use it for the GUI.
>
>So, in a combox, i put: Combo1.ControlSource='thisform.Ado1.oFields('Name').Value'
>
>Then , i populate the combo from other recordset, and i add a extra item for assig a null value to the field (i need it for the relations)
>
>This work fine, except if the field is defined in Sql Server 2000 like Nullable and the field value is null. When i select any item (excep the null item) NOTHING HAPPEND, no item is selected, the combo.value not change, etc...
>
>But if the field value is different to null, this work fine.
>
>I'm crazy, i need install several copies of this software tomorrow and i need a workaround...
>
>NOTE: The fiel is INT, and when i stop in interactivecahnge, the value (when the field value is null) is "", the displayvalue is .NULL.... Why?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform