求助关于上下移动ListBox中的项,在线等,谢谢啦 在winform下,怎么向上或下移动ListBox中的项啊,谢谢各位啦 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://blog.csdn.net/yanleigis/archive/2007/10/11/1819660.aspx private void button2_Click(object sender, EventArgs e) { if (this.listBox1.SelectedIndex < listBox1.Items.Count - 1) { var a = this.listBox1.Items[this.listBox1.SelectedIndex]; this.listBox1.Items[this.listBox1.SelectedIndex] = this.listBox1.Items[this.listBox1.SelectedIndex + 1]; this.listBox1.Items[this.listBox1.SelectedIndex + 1] = a; this.listBox1.SelectedIndex = this.listBox1.SelectedIndex + 1; } else { MessageBox.Show("不能下移了"); } } private void button3_Click(object sender, EventArgs e) { if (this.listBox1.SelectedIndex==0) { MessageBox.Show("不能上移了"); } var a = this.listBox1.Items[this.listBox1.SelectedIndex]; this.listBox1.Items[this.listBox1.SelectedIndex] = this.listBox1.Items[this.listBox1.SelectedIndex - 1]; this.listBox1.Items[this.listBox1.SelectedIndex - 1] = a; this.listBox1.SelectedIndex = this.listBox1.SelectedIndex - 1; } 求大神解释啊!快被搞死了!软件没法用啊! 使用XPO开发,是不是就不需要建立数据库了啊? 急!!WebService 调用exe应用程序?(只要答案正确,马上给100分) VS2008的Project设置中有一个Target Framework是什么作用? 调用ApiCalls类里面的静态方法为什么出错 各位大侠帮帮我! Asp.net与Word的问题 怎么判断是否使用了代理. 毕业设计 这个sql语句怎么解决? C# SOCKET直接接收16进制数据 在进入一个web页的时候下载网络地址的一个文本该怎么做呢?
{
if (this.listBox1.SelectedIndex < listBox1.Items.Count - 1)
{
var a = this.listBox1.Items[this.listBox1.SelectedIndex];
this.listBox1.Items[this.listBox1.SelectedIndex] = this.listBox1.Items[this.listBox1.SelectedIndex + 1];
this.listBox1.Items[this.listBox1.SelectedIndex + 1] = a;
this.listBox1.SelectedIndex = this.listBox1.SelectedIndex + 1;
}
else
{
MessageBox.Show("不能下移了");
}
} private void button3_Click(object sender, EventArgs e)
{
if (this.listBox1.SelectedIndex==0)
{
MessageBox.Show("不能上移了");
}
var a = this.listBox1.Items[this.listBox1.SelectedIndex];
this.listBox1.Items[this.listBox1.SelectedIndex] = this.listBox1.Items[this.listBox1.SelectedIndex - 1];
this.listBox1.Items[this.listBox1.SelectedIndex - 1] = a;
this.listBox1.SelectedIndex = this.listBox1.SelectedIndex - 1;
}