本文整理汇总了C#中System.Windows.Forms.ComboBox.Update方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.Update方法的具体用法?C# ComboBox.Update怎么用?C# ComboBox.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ComboBox
的用法示例。
在下文中一共展示了ComboBox.Update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetList
Boolean SetList(ComboBox cb, IEnumerable data)
{
if (cb == null || data == null) return false;
try
{
if (!(data is IList))
{
List<Object> list = new List<Object>();
foreach (Object item in data)
{
list.Add(item);
}
data = list;
}
cb.DataSource = data;
//cb.DisplayMember = "value";
cb.Update();
return true;
}
catch (Exception ex)
{
XTrace.WriteException(ex);
return false;
}
}
示例2: BindTemplate
public void BindTemplate(ComboBox cb)
{
var list = new List<String>();
foreach (var item in Engine.FileTemplates)
{
list.Add("[文件]" + item);
}
foreach (String item in Engine.Templates.Keys)
{
String[] ks = item.Split('.');
if (ks == null || ks.Length < 1) continue;
String name = "[内置]" + ks[0];
if (!list.Contains(name)) list.Add(name);
}
cb.Items.Clear();
cb.DataSource = list;
cb.DisplayMember = "value";
cb.Update();
}
示例3: olvCellEditStarting
private void olvCellEditStarting(object sender, CellEditEventArgs e)
{
Console.WriteLine("LKLJKLJKL");
List<String> countries = new List<String> {"testi", "joku", "Hiiri"};
ComboBox cboCombo = new ComboBox();
cboCombo.Bounds = e.CellBounds;
cboCombo.Left = e.CellBounds.Left + 1;
cboCombo.Width = e.CellBounds.Width - 1;
cboCombo.DropDownStyle = ComboBoxStyle.DropDownList;
cboCombo.DisplayMember = "Display";
cboCombo.ValueMember = "ID";
cboCombo.DataSource = countries;
cboCombo.AutoCompleteSource = AutoCompleteSource.ListItems;
cboCombo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cboCombo.Update();
//int intComboEditorSelectedValue = countries.Find(item => item.Display == (string)(e.Value)).ID; e.Control = cboCombo; cboCombo.SelectedValue = intComboEditorSelectedValue; //fails silently
/*
if (e.Column.Text != "Seura")
return;
ComboBox cb = new ComboBox();
cb.Bounds = e.CellBounds;
cb.Font = ((ObjectListView)sender).Font;
cb.DropDownStyle = ComboBoxStyle.DropDownList;
cb.Items.AddRange(new String[] { "Pay to eat out", "Suggest take-away", "Passable", "Seek dinner invitation", "Hire as chef" });
cb.SelectedIndex = ((int)e.Value) / 10;
//cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
cb.Tag = e.RowObject; // remember which person we are editing
e.Control = cb;
*
* */
}
示例4: ComboVendedor
public void ComboVendedor(ComboBox combobox)
{
combobox.DataSource = CarregaComboIDVendedor();
combobox.ValueMember = "VEND_ID";
combobox.DisplayMember = "FUNC_NOME";
combobox.Update();
}