Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Select ListBox Item

  1. #1

    Thread Starter
    Addicted Member Alexandru_mbm's Avatar
    Join Date
    Jul 2007
    Location
    VBForums.com
    Posts
    157

    Resolved [RESOLVED] [2005] Select ListBox Item

    I have this code...

    Code:
            Dim i As Integer
            Dim c As String
    
            i = Me.ListBox1.Items.Count
            c = Me.ListBox1.SelectedItem
    
            Me.ListBox1.Focus()
    
            For Each c In ListBox1.SelectedItems
    
                Me.ListBox2.Items.Add(c)
    
            Next
    
            For Each c In ListBox2.Items
    
                ListBox1.Items.Remove(c)
    
            Next
    
            If i = 0 Then
    
                Me.Timer1.Enabled = False
    
            End If
    How can i make, by clicking a button to select the first item of listbox1 ? I have searched and searched and googled... and lived... duh...!

    Can anyone help me with that line of code ? Thanx!
    I'm still learning VB.NET
    Sorry for my bad english
    Thanks for your help

  2. #2
    Hyperactive Member syntaxeater's Avatar
    Join Date
    Dec 2006
    Location
    Des Moines, IA
    Posts
    460

    Re: [2005] Select ListBox Item

    VB Code:
    1. Me.Timer1.Enabled = (Me.ListBox1.Items.Count <> 0)
    2.         Me.ListBox2.Items.AddRange(Me.ListBox1.Items)
    3.         Me.ListBox1.Items.Clear()
    4.         Me.ListBox2.SelectedIndex = 0

  3. #3

    Thread Starter
    Addicted Member Alexandru_mbm's Avatar
    Join Date
    Jul 2007
    Location
    VBForums.com
    Posts
    157

    Re: [2005] Select ListBox Item

    Thanks alot for the help...
    I'm still learning VB.NET
    Sorry for my bad english
    Thanks for your help

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