[英]Firing Actions from combobox.selectedvalue with c# windows forms
[英]silly problem with combobox SelectedIndex and selectedValue in c# windows application
我對 combobox selectedindex 有一個愚蠢的問題。我有一個用戶控件(UC),我在上面放置了一個 combobox。 在 UC 加載事件中,我將組合綁定到具有 10 行的數據表(甚至列表),然后我想要 select socond 項目,但我得到一個超出范圍的異常。
有趣的是當我評論選擇第二行並運行應用程序組合時有10 個項目。
如果我使用任何東西而不是 BindingSource 我有 prolem.Ho 我可以解決這個問題嗎? 謝謝
編輯 1)這里是代碼:
comboBox1.DataSource = dsBase.Tables["MyDt"];
comboBox1.DisplayMember = "Desc";
comboBox1.ValueMember = "ID";
comboBox1.SelectedIndex = 1;
編輯 1)任何人都可以解釋這些圖像嗎?
圖 1:
圖 2:
圖 3:
圖 4:
好久沒看到前端應用了,不過我想說你需要select這個項目上的Combo DataBinding事件。
BR
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.