Skip to Content
author's profile photo Former Member
Former Member

Combobox .Selected returning null even when I select a value

Hey guys!

I'm having a strange problem in my code. I have a custom form that I created using Screen Painter, and in it there are two comboboxes with the exact same values (Payment Methods).

The problem is: when I try to get the selected value of any of the two comboboxes using ".Selected" it only returns the value if the first item is selected, if I select any other value the .Selected returns null. Does anyone know what could be causing this?

Here is the code I use to fill both comboboxes:

DBDataSource dsDB = oForm.DataSources.DBDataSources.Add("OPYM");


ComboBox formaPgtoCorrente = oForm.Items.Item("cmbCorrPag").Specific;

ComboBox formaPgtoNova = oForm.Items.Item("cmbNovoPag").Specific;

for (int i = 0; i < dsDB.Size; i++)




string value = dsDB.GetValue("PayMethCod", i);

string description = dsDB.GetValue("Descript", i);

formaPgtoCorrente.ValidValues.Add(value, description);

formaPgtoNova.ValidValues.Add(value, description);


catch (Exception) { }


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 07, 2012 at 05:38 PM

    Hi Tania,

    Add a user data source to your form and then connect it to the combo box.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.