Results 1 to 7 of 7

Thread: [RESOLVED] listbox problem

Hybrid View

  1. #1
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: listbox problem

    Code:
        Dim rndm As New Random
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If ListBox1.Items.Count > 0 Then
                Dim i As Integer = rndm.Next(0, ListBox1.Items.Count)
                TextBox1.Text = ListBox1.Items(i).ToString
                ListBox1.Items.RemoveAt(i)
            End If
        End Sub
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  2. #2

    Thread Starter
    Member
    Join Date
    Dec 2009
    Location
    ireland
    Posts
    36

    Re: [RESOLVED] listbox problem

    Absolutely perfect thanks very much dbasnett.
    . Code:
    1. If Form2.ListBox1.Items.Count > 0 Then
    2.             Dim i As Integer = rndm.Next(0, Form2.ListBox1.Items.Count)
    3.             Me.TextBox1.Text = Form2.ListBox1.Items(i).ToString
    4.             Form2.ListBox1.Items.RemoveAt(i)
    5.         End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width