<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web" %>
<head>
	<script language="VB" runat="server">
	public SourceList as string '来源ListBox
	public TargetList as string '目的ListBox
	sub GetItem(sender as Object, e as EventArgs)
		Dim SL as ListBox =Ctype(Page.FindControl(SourceList),ListBox)
		Dim TL as ListBox =Ctype(Page.FindControl(TargetList),ListBox)
		Dim CItem ,TItem as ListItem
		for each CItem in SL.Items
			if CItem.Selected=true then'若己选取
				TL.Items.Add(CItem.Text)'加入
			end if
		next
		for each TItem in TL.Items
			SL.Items.Remove(TItem)'删除
		next
	end sub
	sub GetAllItem(sender as Object, e as EventArgs)
		Dim SL as ListBox =Ctype(Page.FindControl(SourceList),ListBox)
		Dim TL as ListBox =Ctype(Page.FindControl(TargetList),ListBox)
		Dim CItem ,TItem as ListItem
		for each CItem in SL.Items
			TL.Items.Add(CItem.Text)
		next
		for each TItem in TL.Items
			SL.Items.Remove(TItem)
		next
	end sub
	sub RemoveItem(sender as Object, e as EventArgs)
		Dim SL as ListBox =Ctype(Page.FindControl(SourceList),ListBox)
		Dim TL as ListBox =Ctype(Page.FindControl(TargetList),ListBox)
		Dim CItem ,TItem as ListItem
		for each CItem in TL.Items
			if CItem.Selected=true
				SL.Items.Add(CItem.Text)
			end if
		next
		for each TItem in SL.Items
			TL.Items.Remove(TItem)
		next
	end sub
	sub RemoveAllItem(sender as Object, e as EventArgs)
		Dim SL as ListBox =Ctype(Page.FindControl(SourceList),ListBox)
		Dim TL as ListBox =Ctype(Page.FindControl(TargetList),ListBox)
		Dim CItem ,TItem as ListItem
		for each CItem in TL.Items
			SL.Items.Add(CItem.Text)
		next
		for each TItem in SL.Items
			TL.Items.Remove(TItem)
		next
	end sub
	</script>
</head>
<asp:button id="b1" Text=">" Font-size="10" Width="20" OnClick="GetItem" Runat="server" /><br>
<asp:button id="b2" Text=">>" Font-size="10" Width="20" OnClick="GetAllItem" Runat="server" /><br>
<asp:button id="b3" Text="<" Font-size="10" Width="20" OnClick="RemoveItem" Runat="server" /><br>
<asp:button id="b4" Text="<<" Font-size="10" Width="20" OnClick="RemoveAllItem" Runat="server" />

