Problem in oCombo.SelectExclusive
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
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 ?
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.