By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Sub procedure to display description of selected items on a Listbox and update

P: 1
I writing a program that lets me enter the name of an item to swap and the adds it to an array list when a button Add is pressed. Once the item is added to the array list a sub procedure should be called which displays the contents of the array list in a list box.

The system will also allow me to remove items from the array list and update the listbox.


I have written this script to add items to the listbox1 i called lstSwapList.I would need some assistance on the Sub Procedure to display the Value or Description on the other listbox2 called lstContent.

I would also want to know how to update the Listbox content,However i hv added a sample of the way i gues it may be.
Any complete solution from anybody on the sub procedure and the update swap procedure will be greately appreciated.

Expand|Select|Wrap|Line Numbers
  1. Partial Class _Default 
  2.     Inherits System.Web.UI.Page 
  3.  
  4.     Protected Sub lstContent_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstContent.SelectedIndexChanged 
  5.  
  6.     End Sub 
  7.  
  8.     Protected Sub lstSwapList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstSwapList.SelectedIndexChanged 
  9.  
  10.     End Sub 
  11.  
  12.     Protected Sub btnAddSwap_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddSwap.Click 
  13.         Dim SwapValue As String = "Sixty Pounds" 
  14.         Dim Counter As Integer = 8 
  15.         Dim SwapN0 As Integer 
  16.  
  17.         lstSwapList.Items.Add(SwapValue) 
  18.         lstSwapList.Items.Add(Counter) 
  19.         lstSwapList.Items.Add(New ListItem("300", "1")) 
  20.         lstSwapList.Items.Add(New ListItem("ASP.Net", "2")) 
  21.         lstSwapList.Items.Add(New ListItem("Programming", "3")) 
  22.  
  23.  
  24.  
  25.         SwapN0 = lstSwapList.SelectedValue 
  26.  
  27.         For Counter = 0 To -1 
  28.             SwapN0 = lstContent.Items.Count 
  29.         Next 
  30.  
  31.  
  32.     End Sub 
  33.  
  34.     Protected Sub btnDeleteSwap_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDeleteSwap.Click 
  35.         lstSwapList.Items.Remove(lstSwapList.SelectedValue) 
  36.     End Sub 
  37.  
  38.     Protected Sub btnUpdateSwap_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdateSwap.Click 
  39.  
  40.     End Sub 
  41. End Class 
  42.  
  43. ======================================= 
  44. Sub UpdateSwap(ByVal valueA As String, ByVal ValueBAs String, ByVal ValueC As Integer, ByVal ValueD As Date) 
  45.  
Mar 26 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.