如何操作listbox问题 把数据初始化显示放到if(!Page.IsPostBack){}里面 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 重新绑定ListBox1.DataSource = null; ListBox1.DataSource = MyArrayList; 有了进展现在的问题是当del the last row时出错.............If lstTest.SelectedIndex <> -1 Then GetIndexOk(Me.txtId.Text) myDivisions1.RemoveAt(intCurSelectIndex) lstTest.DataSource = Nothing lstTest.DataSource = myDivisions1 lstTest.DisplayMember = "getName" lstTest.ValueMember = "getId"End If.............此时lstTest默认没有选中行,选中某行时出错.system.ArgumentOutOfRangeExcetion index值范围出错. 经过尝试,lstTest.DataSource =myDivisions1 这种方法在删除时有如上bug! 不能实现.改用lstTest.items.add方法,经过尝试,有如下缺点,1.不能备份key值,所有信息都要显示.2.修改时,不能及时更新listbox控件.例)设置Me.lstTest.SelectedItem = NewInformation但是实际显示Me.lstTest.SelectedItem = OldInformation-------------------------------------------棘手的问题,没有好办法. 这个问题我记得有人问过http://community.csdn.net/Expert/topic/3044/3044084.xml?temp=.1090204 如何把列向数据库数据变成横向数据显示(datagridview) Oracle date 类型 where 条件应用 强命名测试 在c# 窗体中如何嵌入Excel,并完成相应的修改和保存? 请问大家一个Graphics写字的问题...没有在鼠标点击的位置显示... Regex.Replace 结果非常出乎意料! 正则高手请帮忙... 如何实现FORM的值返回到调用页 小鸟在等待——关于C#中的异常处理 关于Steam占内存问题 如何制作一个录音功能,两天内结贴 如何可以知道在一个矩形中可以写多少个字啊? 怎样创建一个需要注册的程序
ListBox1.DataSource = null;
ListBox1.DataSource = MyArrayList;
现在的问题是
当del the last row时出错.
............
If lstTest.SelectedIndex <> -1 Then
GetIndexOk(Me.txtId.Text)
myDivisions1.RemoveAt(intCurSelectIndex)
lstTest.DataSource = Nothing
lstTest.DataSource = myDivisions1
lstTest.DisplayMember = "getName"
lstTest.ValueMember = "getId"
End If
.............
此时lstTest默认没有选中行,选中某行时出错.system.ArgumentOutOfRangeExcetion index值范围出错.
1.不能备份key值,所有信息都要显示.
2.修改时,不能及时更新listbox控件.
例)
设置
Me.lstTest.SelectedItem = NewInformation
但是实际显示
Me.lstTest.SelectedItem = OldInformation
-------------------------------------------
棘手的问题,没有好办法.