System.Data.DataRowView
System.Data.DataRowView在LISTBOX选择的时候老是提示如上
MessageBox.Show(listBox1.SelectedItem.ToString());
是C# WINFROM的.
listBox1.DataSource = Dt.DefaultView;
listBox1.DisplayMember = "displaylabel";
listBox1.ValueMember = "colname"; 这个是邦定的。 你的意思是在绑定后在LISTBOX1中显示的是System.Data.DataRowView
?? 不是啊,是点击LISTBOX1内容后.显示对应的显示值 如果你在Form_Load事件中設置listBox的屬性,會產生這個問題。解決方法,1) 在Form中設置一個flag,如isFormLoading,Form_Load時為False,form_open時為true,然后在ListBox_SelectIndexChange事件中,只有isFormLoading 為 false才設置這些屬性值。2) 用ListBox.Items.Add
页:
[1]
