【发布时间】:2017-08-30 05:18:36
【问题描述】:
我在我的 UI 中添加了一个组合框。
<Control Id ="ExistingPortCombo" Type="ComboBox" X="120" Y="120" Width="200" Height="50" Property="ComboSelectedPort" ComboList="yes" >
<ComboBox Property="ComboSelectedPort" />
</Control>
我希望它从自定义操作中填充。我试着这样做。
这是我填充列表的功能
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);
}
}
然后我称之为:
AddRecordToComboBox("ComboSelectedPort", text, value,"ComboBox");
此方法适用于列表框,但对于组合框会出错。
谁能看到我在这里做错了什么?
【问题讨论】:
标签: wix windows-installer wix3.6