I have added a combo box to my UI.
<Control Id ="ExistingPortCombo" Type="ComboBox" X="120" Y="120" Width="200" Height="50" Property="ComboSelectedPort" ComboList="yes" >
<ComboBox Property="ComboSelectedPort" />
</Control>
I want it to populate from a custom action. I trid to do so as bellow.
Here is my function to populate lists
static int index = 0;
private static void AddRecordToList(string propertyName,string text,string value,string control)
{
try
{
View view = CurrentSession.Database.OpenView("SELECT * FROM " + control);
view.Execute();
Record record = CurrentSession.Database.CreateRecord(4);
record.SetString(1, propertyName);
record.SetInteger(2, ++index);
record.SetString(3, text);
record.SetString(4, value);
view.Modify(ViewModifyMode.InsertTemporary, record);
view.Close();
}
catch (Exception ex)
{
global::System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
And then I call as:
AddRecordToComboBox("ComboSelectedPort", text, value,"ComboBox");
This method works for list boxes but but for Combo box gives errors.
Can anyone see what i am doing wrong here?
Based on this post, I could populate the combo box
to be created combobox table in the .msi I had to add a item to a value.
the item i added here was not listed on my ComboBox, so for now this is OK for now. If any one knows how to do this by a proper way answers are welcome.
My controller is now looks like this.