刚接触ASP.NET 想做一个关于listbox增添删改的程序
目前的代码是这样的
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace ListBoxMode
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ } private void buttonAdd_Click(object sender, EventArgs e)
{
listBox2.Items .Add(listBox1.SelectedItem); //将选中listbox1中的选中的项向listbox2里面添加项
} private void buttonDelete_Click(object sender, EventArgs e)
{
listBox2.Items.Remove(listBox2.SelectedItem); //删除lisbox2里面的选中飞项
} //下面是我想写的使滚动条滚动的代码,可是一滚就滚动到最后面去了,还来不及选择
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
listBox1.SelectedItem = listBox1.Items[listBox1.SelectedIndex + 1]; /
} }
}希望各种高手们帮忙解决一下
目前的代码是这样的
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace ListBoxMode
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ } private void buttonAdd_Click(object sender, EventArgs e)
{
listBox2.Items .Add(listBox1.SelectedItem); //将选中listbox1中的选中的项向listbox2里面添加项
} private void buttonDelete_Click(object sender, EventArgs e)
{
listBox2.Items.Remove(listBox2.SelectedItem); //删除lisbox2里面的选中飞项
} //下面是我想写的使滚动条滚动的代码,可是一滚就滚动到最后面去了,还来不及选择
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
listBox1.SelectedItem = listBox1.Items[listBox1.SelectedIndex + 1]; /
} }
}希望各种高手们帮忙解决一下
解决方案 »
- webclient 和HttpWebRequest采集的区别
- 自己开发的网站如何整合uc+dz
- C#中可以直接调用函数来计算方差么
- 关于dropdownlist 的一个细节问题
- 有ASP.net项目(日本项目更好)开发经验的想来大连发展的来找我
- 菜鸟请教:如何取得刚刚插入数据库的数据的ID值?
- textbox的问题,我想实现一个调用text_changed的事件,还不想刷新画面。服务器端有数据库处理。急急急急!!!!!!!!!
- 在APS.NET中有办法在服务器的执行过程中动态返回执行状态吗?
- 关于dropdownlist的问题
- 100分寻OA的相关设计方案?不要提案和大纲,要软件的需求分析。
- 求一个经典的小程序
- 工具箱中的"移动WEB控件"这个子工具条默认没有,如何让它出现?
for(int i=ListBox1.Items.Count- 1;i>0;i--)
{
if(ListBox1.Items[i].Selected)
js+="document.getElementById('"+ListBox1.ClientID+ "').options["+i +"].selected=true; "+System.Environment.NewLine;
}
Page.RegisterStartupScript("js",js);