如何将数据库值传输到组合框? [英] How can I transfer database value to a combobox?
本文介绍了如何将数据库值传输到组合框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我做了一个双击事件,您可以双击链接到数据库的列表框项目,并填写表格。
I made a doubleclick event where you can doubleclick on a listbox item linked to a database, and it fills in a form.
我有一个类别的组合框和金额和名称的2个文本框。
I have a combobox for the category and 2 textboxes for the amount and the name.
使用我试过的代码。
with the code I tried this.
private void lbHuis_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
hetHuis = (chalet)lbHuis.SelectedItem;
naamcode.Text = hetHuis.Naamcode;
personenaantal.Text = Convert.ToString(hetHuis.Persoonaantal);
klasse.SelectedItem = hetHuis.Klasse;
}
2个文本框被填充,但组合框没有。我该如何解决这个问题?
The 2 textboxes get filled, but the combobox doesnt. How can I fix this?
我只想要组合框中的值。
I just want the value in the combobox.
推荐答案
没问题,可能是huis中的Klasse不等于组合框中的项目
No problem, maybe is the Klasse in huis not equal to an item in the combobox
这篇关于如何将数据库值传输到组合框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文