Unable to populate EpiCombo using UDCodes and C#

Hello,

When I add an EpiCombo control to my screen using the toolbox and set the properties to link UDCodes as the datasource, I am able to see accurate data in that control. However, when I create an EpiCombo object in my C# code and try to do the same thing, the EpiCombo object does not seem to have any data (objEpiCombo.Rows.Count is 0).

Here’s what I am trying to accomplish. I have a custom field in the RMADtl_UD table, and I want to bind that field to UDCodes table. So, after creating this custom field (MyCustomField_c), I set the Extended Properties to point to UDCodes (the way it is mentioned in several posts related to this topic) and wrote my customization code. Here is my C# code -

objEpiCombo.EpiBinding = “RMADtl.MyCustomField_c”;
objEpiCombo.EpiBOName = “Ice:BO:UserCodes”;
objEpiCombo.EpiTableName = “UDCodes”;
objEpiCombo.DisplayMember = “CodeDesc”;
objEpiCombo.ValueMember = “CodeID”;
objEpiCombo.EpiDataSetMode = DataSetMode.RowsDataSet;
objEpiCombo.RetrieveOnActivate = true;
objEpiCombo.SearchFilter = “CodeTypeID=‘RMACustomField’”;

Eventually, my goal is to add this EpiCombo to the EpiUltraGrid on the screen, but the EpiCombo object itself is not getting populated with any data. I am not sure what Isteps am missing. Can someone please help?

Thank you in advance!

The best way is to set the extended properties of the UD field to use that CodeTypeID. Then, when you add the ComboBox and bind it to the custom field, it automatically brings in the correct logic.

Thank you for your response, Jason. By doing that, I was able to add the control manually to the screen and set the properties to see the data. The step where I was failing was when I created the EpiCombo object in memory. I was able to work around this problem by using the combo object that I added to the form by drag-and-drop, instead of creating a new object in memory.