Is there a way of getting to a binding source's column without knowing the column name? Here's the scenario:
I have a form with a binding source. On the form is a tab page containing a user control that itself has controls. A method in the user control is called from the form to bind the controls to its binding source. Basically, I run through a list of controls with a corresponding list of data-source columns and bind them using:
curControl:DataBindings:Add(NEW System.Windows.Forms.Binding
("Value", formBindingSource, ENTRY(iControlCtr,cFieldList), TRUE)).
where curControl is of type System.Windows.Forms.Control.
This works great.
Now, in some other code, I know the control and want to get to the bound column's data type. I do not know the name of the column.
I looked at the Labelmanager.cls example, but it uses the column name (bindings:item). I attempted using a numeric index, but got an error that the "Specified indexer type doesn't match any type required by the object".
In my code, I get the control and then want to find the datatype:
curControl = CAST(sender,System.Windows.Forms.Control).
myDataType = curControl:DataBindings:something:something.
Any help would be greatly appreciated.
JL
This is waaay too late but. this works for UltraTextEditors. Other controls like numeric editors would use "Value" instead of "Text".
oBindingSource = CAST(oControl:DataBindings["Text"]:DataSource, Progress.Data.BindingSource) NO-ERROR.
IF VALID-OBJECT(oBindingSource) THEN
DO:
cBindField = oControl:DataBindings["Text"]:BindingMemberInfo:BindingField.
cDataType = oBindingSource:HANDLE:GET-BUFFER-HANDLE(1):BUFFER-FIELD(cBindField):DATA-TYPE.
END.