【发布时间】:2015-03-08 01:38:43
【问题描述】:
我想从字典中填充一个组合框,但我收到了 error of argument 2: cannot convert from 'int' to 'class'。该类是条形码阅读器。我应该怎么做?还有其他选择吗?
这是我想使用但不起作用的代码:
private static Dictionary<string, BarcodeReader> CodeType =
new Dictionary<string, BarcodeReader>
{
{"Codabar", BarcodeReader.CODABAR},
{"Code 39", BarcodeReader.CODE39},
};
// Populate cbobox
cboCodeType.Items.AddRange(CodeType.Keys.ToArray());
cboCodeType.SelectedIndex = 0;
【问题讨论】:
标签: dictionary combobox populate