0

how to move items from listbox1(which is populated from backend database) to listbox2(which is empty).
Now after that i have to add listbox2 items to database.
Thank u in advance......

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by willopt_ric
0

Like this :

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Index As Byte = 0
        Dim Item As New ListItem

        If ListBox1.SelectedIndex <> -1 Then
            Index = ListBox1.SelectedIndex

            Item.Text = ListBox1.SelectedItem.ToString
            Item.Text = ListBox1.SelectedValue.ToString

            ListBox2.Items.Add(Item)
            ListBox1.Items.RemoveAt(Index)
        End If
    End Sub

Sub ActionSave()
  Dim No As Byte = 0
  Dim TrxID As String = ""
  Dim SQL As String = ""
  For No = 0 To ListBox2.Items.Count - 1               
        TrxID  = ListBox2.Items(No).Value
        SQL = "INSERT INTO Trx VALUES('" & TrxID & "')"
  Next No
End Sub

Edited by Kusno: ..

0

how to move items from listbox1(which is populated from backend database) to listbox2(which is empty).
Now after that i have to add listbox2 items to database.
Thank u in advance......

Hi Raman....i dnt hav .net framework.....so i cannot write the xact code..bt in the button click event the code is.....
foreach(ListItem li in ListBox1.Items)
{
if(li.Selected==true)
{
ListBox2.Items.Add(li);
}
}
Please Mark "answered " if ur r content...../pleased to know abt further clarification regardings...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.