2 Replies - 13968 Views - Last Post: 27 December 2009 - 10:40 AM Rate Topic: -----

#1 lackan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 04-December 09

Select the first item in a listbox

Posted 27 December 2009 - 10:25 AM

Let me explain..

I want a code that selects the first item in a listbox when I press on a button

Thanks
!
Is This A Good Question/Topic? 0
  • +

#3 LeisureProgrammer  Icon User is offline

  • N00by VB.NET Developer
  • member icon

Reputation: 110
  • View blog
  • Posts: 588
  • Joined: 06-September 09

Re: Select the first item in a listbox

Posted 27 December 2009 - 10:32 AM

It's against the rules of this forum to give out real code without seeing some effort. Here are some clues for you ;)
clue1: ListBox1.SelectedItem() Can be used to get or set selected items in the list box.
clue2: ListBox1.Items.Item(0) represents the first item (index 0) in the list box.

And for the third "clue", here is some pseudo code
Dim yourAnswer as String = clue1.textInRectangle & "=" & clue2.textInRectangle



You could have just used intellisense to find out how to do something like this.

This post has been edited by LeisureProgrammer: 27 December 2009 - 10:41 AM

Was This Post Helpful? 1
  • +
  • -

#4 lackan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 04-December 09

Re: Select the first item in a listbox

Posted 27 December 2009 - 10:40 AM

View PostLeisureProgrammer, on 27 Dec, 2009 - 09:32 AM, said:

It's against the rules of this forum to give out code without seeing some effort. Here are some "clues" for you ;)
clue1) ListBox1.SelectedItem() Can be used to get or set selected items in the list box.
clue2) ListBox1.Items.Item(0) represents the first item (index 0) in the list box.

Dim yourAnswer as String = clue1 & "=" & clue2



You could have just used intellisense to find out how to do something like this.



Alright, thanks! figured it out :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1