Results 1 to 6 of 6

Thread: Listbox Help [2005]

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    4

    Listbox Help [2005]

    Hi,
    I have made an application which does some mathematical calculations which are linked to the Newton-Raphson process and the results are displayed in a listbox.
    Often there are lots of results, and whereas all of them have to be displayed, I only want to look at the last couple, so is there an easy way to make the listbox containing the results scroll down right to the bottom to the last entry, and how can i easily copy items from the list box (using some type of ctrl + c)?

    Thanks
    Augustus_Caesar

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Listbox Help [2005]

    VB Code:
    1. ListBox1.SelectedIndex = ListBox1.Items.Count - 1
    will scroll (and select) your listbox to the last item in the list

  3. #3
    Lively Member
    Join Date
    Mar 2006
    Posts
    69

    Re: Listbox Help [2005]

    To copy the selection in a listbox you can use this:

    VB Code:
    1. Private Sub listbox1_Keypress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles listbox1.KeyDown
    2.                If e.Control Then
    3.             If e.KeyCode = Keys.C Then
    4.                 MsgBox("You can now do what you want with this:" & listbox1.selecteditem)
    5.             End If
    6.         End If
    7.     End Sub
    2B || !2B

  4. #4
    Lively Member
    Join Date
    Jun 2006
    Posts
    64

    Re: Listbox Help [2005]

    hi what code do you use to send the string/selected item to the clipboard?
    VS 2003

  5. #5
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Listbox Help [2005]

    VB Code:
    1. Clipboard.SetText(ListBox1.SelectedItem)
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  6. #6
    Lively Member
    Join Date
    Jun 2006
    Posts
    64

    Re: Listbox Help [2005]

    tres bien
    merci beaucoup
    VS 2003

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