1 Replies - 7334 Views - Last Post: 17 November 2005 - 02:40 PM Rate Topic: -----

#1 polishPrincess83  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 27-September 05

create list box

Posted 02 November 2005 - 11:43 AM

Instructions: Create list box that allows the user to select more than one item at a time. First program single button (which I did successfully-shown below) then program multi button when selection mode property is set to MultiExtended. It says to do that by clearing the contects of the Result Label but when I do that it just makes that label blank when I click on multi button. The result should have all the names selected on seperate lines in the Result Label.

This is what I have so far:

Private Sub MultiForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'fills the list box with data

Me.uiNamesListBox.Items.Add("Ahmad")
Me.uiNamesListBox.Items.Add("Jim")
Me.uiNamesListBox.Items.Add("Debbie")
Me.uiNamesListBox.Items.Add("Jeanne")
Me.uiNamesListBox.Items.Add("Bill")
End Sub

Private Sub uiSingleButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uiSingleButton.Click
Dim name As String
name = Me.uiNamesListBox.Text
Call DisplayName(name)
End Sub

Private Sub DisplayName(ByVal name As String)
Me.uiResultLabel.Text = name
End Sub

Is This A Good Question/Topic? 0
  • +

Replies To: create list box

#2 DaArmy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-September 05

Re: create list box

Posted 17 November 2005 - 02:40 PM

This is what i did for the multi button's click even procedure. I believe we are talking about the exact same problem from the exact same book.

Private Sub uiMultiButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uiMultiButton.Click

Dim count As Integer

Me.uiResultLabel.Text = ""

For count = 1 To Me.uiNamesListBox.SelectedItems.Count

Me.uiResultLabel.Text = Me.uiResultLabel.Text & Convert.ToString(Me.uiNamesListBox.SelectedItems(count - 1)) & ControlChars.NewLine

Next count
End Sub

Let me know if you have a question. Have fun.

DaArmy

This post has been edited by DaArmy: 17 November 2005 - 03:11 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1