Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem in oCombo.SelectExclusive

Hi,

I am trying to use a value in a combobox.

This is the code I use:

-


<i>oCombo = oForm.Items.Item("CmbPrd").Specific

oCombo.DataBind.SetBound(True, "", "CmbPrd")

oRS.DoQuery("SELECT T0.Code, T0.Name FROM OFPR T0")

For ii = 0 To oRS.RecordCount - 1

oCombo.ValidValues.Add(oRS.Fields.Item(0).Value, oRS.Fields.Item(1).Value)

oRS.MoveNext()

Next ii

oCombo.SelectExclusive(0, SAPbouiCOM.BoSearchKey.psk_Index)

Prd = oCombo.Selected.Value</i>

-


when trying to do the last line, I get:

"Object reference not set to an instance of an object" Error.

ocombo.selected has a value of nothing.

I have tried using the 'Select' method instead of 'SelectExclusive' and it still doesnt work.

I am using 2005A SP01.

I think it used to work on previous versions.

Am I doing something wrong ? Anyone has an idea ?

Thanks,

Yuval.

Former Member
replied

I never use databinding. Ever. I'd rather have control over reading/writing data than to faithfully rely on some mysterious black box that you can't touch.

I would first try turning off the databinding to see if it's causing a problem.

It sounds like when you're doing the select that something's happening that's causing the value to be de-selected. I'd check to see if something's happening in the Combo_Select event on the form that might not be trapping an error or it's clearing your selection for some reason.

Are you positive that oCombo.Selected is nothing? If it has something in it, then Prd may be the problem.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question