this.ListBox2 .Items .Add(this.ListBox1 .Items[0]);
this.ListBox1 .Items .RemoveAt(0);
解决方案 »
- 数据类型不匹配,急救!!
- 文件名为%D6%DC%BD%DC%C2%D7%20-%20%C2%D2%CE%E8%B4%BA%C7%EF.lrc如何转换成正常能阅读的文件呢?
- 讨论有分,可再加!!各位大师看看我的数据实体设计思路?
- 小问题,,散分,,,要接分的快来..!!!
- 我已知MSSQL服务器的IP地址及数据库名,可不知SA密码及其它密码,如何登录这个数据库,能不能通过编程登录这个MSSQL数据库??
- 如何得到类中的属性生成表的列?
- 大家有开发移动商务的吗?
- 请问: 为何流读出文本汉字是乱码?
- 谁能告诉我怎样写出XP风格的窗体
- 连接SQL SERVER的ConnectionSting 如何写,谢了!!!
- 急! vb 6.0代码到c#.net中实现
- 请教高手,在线等,急着用!!!
<HTML>
<HEAD>
<title>WebForm2</title>
<script runat="server" language="C#"> private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面 // 给 ListBox2 和 ListBox3 赋值 if(!IsPostBack)
{
for(int i=0;i<4;i++)
{
ListBox2.Items.Add("ListBox2_"+i.ToString());
ListBox3.Items.Add("ListBox3_"+i.ToString());
}
} this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
} // ListBox2 >> ListBox3
private void Button1_Click(object sender, System.EventArgs e)
{
if( ListBox2.SelectedItem != null)
{
ListItem tempItem = ListBox2.SelectedItem;
ListBox2.Items.Remove(tempItem);
ListBox3.Items.Add(tempItem);
ListBox3.SelectedIndex = -1;
}
}
// ListBox3 >> ListBox2
private void Button2_Click(object sender, System.EventArgs e)
{
if( ListBox3.SelectedItem != null)
{
ListItem tempItem = ListBox3.SelectedItem;
ListBox3.Items.Remove(tempItem);
ListBox2.Items.Add(tempItem);
ListBox2.SelectedIndex = -1;
}
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<asp:ListBox id="ListBox2" style="Z-INDEX: 101; LEFT: 88px; POSITION: absolute; TOP: 200px" runat="server"
Width="96px" Height="128px"></asp:ListBox>
<asp:ListBox id="ListBox3" style="Z-INDEX: 102; LEFT: 240px; POSITION: absolute; TOP: 200px"
runat="server" Width="96px" Height="120px"></asp:ListBox>
<asp:Button id="Button1" style="Z-INDEX: 103; LEFT: 104px; POSITION: absolute; TOP: 152px" runat="server"
Text=" >> "></asp:Button>
<asp:Button id="Button2" style="Z-INDEX: 104; LEFT: 256px; POSITION: absolute; TOP: 152px" runat="server"
Text=" << "></asp:Button>
</form>
</body>
</HTML>
http://lucky.myrice.com/javascriptexam/add_del_Select.htm