我有一个带有 3 个组合框和一个 XML 文件的 Windows 窗体,如下所示
<?xml version="1.0"?>
<shrtcutkeys>
<Keysmain>
<keychars>
<key1>
Ctrl
</key1>
<key1>
Alt
</key1>
<key1>
Shift
</key1>
</keychars>
</Keysmain>
<Seckeys>
<keychars>
<key2>
Ctrl
</key2>
<key2>
Alt
</key2>
<key2>
Shift
</key2>
</keychars>
</Seckeys>
<Alphas>
<keychars>
<key3>
a
</key3>
<key3>
b
</key3>
<key3>
c
</key3>
</keychars>
</Alphas>
</shrtcutkeys>
所以我想在combobox1中显示所有key1,在combox2中显示所有key2等等..尝试这样做但没有真正工作
DataSet dsSet = new DataSet();
dsSet.ReadXml("C:\\Users\\jackandjill\\Documents\\Visual Studio 2010\\Projects\\highlite\\highlite\\keys.xml");
comboBox1.DataSource = dsSet.Tables["keys"];
comboBox1.DisplayMember = "key1";