dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: First line in listbox

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    First line in listbox

    [Originally posted by kenneth G]

    Hi folks,

    i have a listbox with 100 lines of information. What i need help for is the following :

    I want the first line in the listbox to be selected automatically, then move that line to text1.text....

    dim i as integer
    text1.text = list1.list(i)

    Thanks for all help in advance... :))

    Regards
    Kenneth G



  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:First line in listbox

    [Originally posted by Mike Lyons]

    The index of the first line in the listbox is 0, so:

    List1.ListIndex = 0

    Text1.Text = List1.List(0)


    Mike

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:First line in listbox

    [Originally posted by kenneth G]

    Thanks a lot Mike, it worked very well :))

    Kenneth G

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:First line in listbox

    [Originally posted by Jim]

    If you want text1 to be in sync with the listbox, you can set the onclick event for the listbox to something like this
    Text1.Text = List1.Text

    In the onload event you can set the listbox initial value
    List1.ListIndex = 0

    When the form loads, the listindex is set to 0 and the onclick event is fired changing the textbox

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:First line in listbox

    [Originally posted by Jim]

    If you want text1 to be in sync with the listbox, you can set the onclick event for the listbox to something like this
    Text1.Text = List1.Text

    In the onload event you can set the listbox initial value
    List1.ListIndex = 0

    When the form loads, the listindex is set to 0 and the onclick event is fired changing the textbox

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center