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......

Recommended Answers

All 2 Replies

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

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.