我有我鑄造我的下拉列表對象使用ChaseSelection類,C#有什麼不對我的循環
現在我試圖把該值從數據庫中作爲默認值在下拉列表,但似乎沒有工作,任何人都可以幫忙嗎?我甚至不認爲我的循環運行。這裏是我chaseselection類,並且也把下面的循環:由於
public class ChaseSelectionItems
{
public string code { get; set; }
public string text { get; set; }
public ChaseSelectionItems(string code, string text)
{
this.code = code;
this.text = text;
}
public override string ToString()
{
return this.text;
}
}
foreach (ChaseSelectionItems items in drpdwnChaseSecSelection.Items)
{
if (items.code == _Row.xcs_View)
{
drpdwnChaseSecSelection.SelectedValue = items.text;
}
}
放一個斷點,看看調試中發生了什麼 – Habib
define「似乎並不工作」。你有編譯錯誤嗎?運行時出現異常? (哪一個?)它沒有拋出任何異常,但它不像你期待的那樣行事? –
你使用哪個UI框架? WPF,WinForms等? –