I have a simple .aspx webpage with two listboxes. I start on the initial page load by binding Listbox1 to a datatable and Listbox2 to another datatable :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Label1.Text = ADS1.ConnectionString
If Not Page.IsPostBack Then
Private Sub ListLoad()
Dim dv As System.Data.DataView = CType(ADS1.Select(DataSourceSelectArguments.Empty), System.Data.DataView)
dt = dv.ToTable
cdt = dt.Clone
ListBox1.DataSource = dt
ListBox1.DataValueField = "ID"
ListBox1.DataTextField = "FullName"
ListBox2.DataSource = cdt
ListBox2.DataValueField = "ID"
ListBox2.DataTextField = "FullName"
So far everything is working fine and I have the two listboxes to play around with and can move stuff back and forth once the listboxes have been bound to a null. My issue is trying to move the data in the datatables back and forth (which is why I set up two datatables and bound the listboxes in the first place). Could someone please explain and possibly provide an example of how I could find the associated row in dt and move it to cdt if that corresponding row in listbox1 is selected? Ideally I want to be able to handle multiple selected values in Listbox1 use 'For Each item As ListItem In ListBox1.Items...Next' to handle this. Thanks a ton!