To Transfer items from one listbox to another

whe i run with this code the items are being transferred one by one. B

Page 1 of 1

1 Replies - 8906 Views - Last Post: 03 September 2009 - 12:42 PM Rate Topic: -----

#1 santoshr_2006  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-September 09

To Transfer items from one listbox to another

Post icon  Posted 03 September 2009 - 12:36 PM

Private Sub butttonmove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonmove.Click
		If listbox1.SelectedIndex < 0 Then
			MsgBox("Please Select Data", MsgBoxStyle.Exclamation, "Form")
		Else
			If listbox1.Items.Count > 0 Then
			   listbox2.Items.Add(listbox1.SelectedItem)
			   listbox1.Items.Remove(listbox1.SelectedItem)
			End If
		End If
	End Sub




when i run with this code the items are being transferred one by one from one list box to another listbox.
But i need to transfer multiple items at a time.

This post has been edited by santoshr_2006: 03 September 2009 - 12:39 PM


Is This A Good Question/Topic? 0
  • +

Replies To: To Transfer items from one listbox to another

#2 T3hC13h  Icon User is offline

  • D.I.C Regular

Reputation: 65
  • View blog
  • Posts: 337
  • Joined: 05-February 08

Re: To Transfer items from one listbox to another

Posted 03 September 2009 - 12:42 PM

Iterate through the SelectedItems property.

This post has been edited by T3hC13h: 03 September 2009 - 12:42 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1