473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

auto selecting the 1st item in a list view...

As part of my vb.net 2005 application I would like to automatically select
the very first item (index 0) in a listview containing menu items. That way
the the listviews "afterselect" event would fired - hence running the code
pertaining to that first menu item.

How can I do this in code?

Thanks, Brad
Jul 25 '07 #1
6 3100
ListBox1.SelectedIndex = 0

"Brad Pears" wrote:
As part of my vb.net 2005 application I would like to automatically select
the very first item (index 0) in a listview containing menu items. That way
the the listviews "afterselect" event would fired - hence running the code
pertaining to that first menu item.

How can I do this in code?

Thanks, Brad
Jul 25 '07 #2
I am sorry - I completlely mislead you. It's a treeview NOT a listview.
there is not a "selectedindex" property in a treeview control...

Help!

Brad

"Tracks" <Tr****@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
ListBox1.SelectedIndex = 0

"Brad Pears" wrote:
>As part of my vb.net 2005 application I would like to automatically
select
the very first item (index 0) in a listview containing menu items. That
way
the the listviews "afterselect" event would fired - hence running the
code
pertaining to that first menu item.

How can I do this in code?

Thanks, Brad

Jul 26 '07 #3
TreeView1.SelectedNode = 0

"Brad Pears" wrote:
I am sorry - I completlely mislead you. It's a treeview NOT a listview.
there is not a "selectedindex" property in a treeview control...

Help!

Brad

"Tracks" <Tr****@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
ListBox1.SelectedIndex = 0

"Brad Pears" wrote:
As part of my vb.net 2005 application I would like to automatically
select
the very first item (index 0) in a listview containing menu items. That
way
the the listviews "afterselect" event would fired - hence running the
code
pertaining to that first menu item.

How can I do this in code?

Thanks, Brad


Jul 26 '07 #4
Cancel, I mean:

TreeView1.SelectedNode = TreeView1.Nodes(0)

I think? You check it.
"Tracks" wrote:
TreeView1.SelectedNode = 0

"Brad Pears" wrote:
I am sorry - I completlely mislead you. It's a treeview NOT a listview.
there is not a "selectedindex" property in a treeview control...

Help!

Brad

"Tracks" <Tr****@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
ListBox1.SelectedIndex = 0
>
"Brad Pears" wrote:
>
>As part of my vb.net 2005 application I would like to automatically
>select
>the very first item (index 0) in a listview containing menu items. That
>way
>the the listviews "afterselect" event would fired - hence running the
>code
>pertaining to that first menu item.
>>
>How can I do this in code?
>>
>Thanks, Brad
>>
>>
>>
Jul 26 '07 #5
Perfect!! Yes that works!! Great! Thanks for that!!

"Tracks" <Tr****@discussions.microsoft.comwrote in message
news:CE**********************************@microsof t.com...
Cancel, I mean:

TreeView1.SelectedNode = TreeView1.Nodes(0)

I think? You check it.
"Tracks" wrote:
>TreeView1.SelectedNode = 0

"Brad Pears" wrote:
I am sorry - I completlely mislead you. It's a treeview NOT a listview.
there is not a "selectedindex" property in a treeview control...

Help!

Brad

"Tracks" <Tr****@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
ListBox1.SelectedIndex = 0

"Brad Pears" wrote:

As part of my vb.net 2005 application I would like to automatically
select
the very first item (index 0) in a listview containing menu items.
That
way
the the listviews "afterselect" event would fired - hence running
the
code
pertaining to that first menu item.

How can I do this in code?

Thanks, Brad


Jul 26 '07 #6
One other quick question.... When the treeview item node is selected
programatically in this fashion, the node does not appear highlited as it
would when you click on it with the mouse. Other than actually setting a
background colour for the node, can you think of an easy way to get this to
happen? I want the user to see which item has been automatically selected...

Thanks, Brad

"Tracks" <Tr****@discussions.microsoft.comwrote in message
news:CE**********************************@microsof t.com...
Cancel, I mean:

TreeView1.SelectedNode = TreeView1.Nodes(0)

I think? You check it.
"Tracks" wrote:
>TreeView1.SelectedNode = 0

"Brad Pears" wrote:
I am sorry - I completlely mislead you. It's a treeview NOT a listview.
there is not a "selectedindex" property in a treeview control...

Help!

Brad

"Tracks" <Tr****@discussions.microsoft.comwrote in message
news:E3**********************************@microsof t.com...
ListBox1.SelectedIndex = 0

"Brad Pears" wrote:

As part of my vb.net 2005 application I would like to automatically
select
the very first item (index 0) in a listview containing menu items.
That
way
the the listviews "afterselect" event would fired - hence running
the
code
pertaining to that first menu item.

How can I do this in code?

Thanks, Brad


Jul 26 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Phil Powell | last post by:
I am producing a form using PHP on the back end and Javascript on the front end. The resulting script will come to the browser as follows: <script> <!-- function selectAll() { moveElement =...
4
by: Paddy | last post by:
How do I select a subitem from a listview after clicking on the first column? Couldn't find it in MSDN. Thank you. Paddy.
3
by: larry mckay | last post by:
anyone have the code to select and listview item or row (subitems) after a doubleclick event from a listview. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate...
3
by: Brent Hoskisson | last post by:
I can't figure out what I'm missing here. I set up a list view control. As I load the form, I select one of the items in the list view control: lvwPrograms.Items(0).Selected = True ...
0
by: Benny Raymond | last post by:
I have a list view and a button that turns the currently selected item's ForeColor to SystemColors.GrayText The problem I'm having is that when the user clicks in white space, the item becomes...
6
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key...
4
by: darrel | last post by:
I have a DDL list along these lines: item value="1" text="a" item value="2" text="b" item value="3" text="c" item value="2" text="d" item value="2" text="e" item value="1" text="f" item...
2
by: SonOf27 | last post by:
I'm looking for some way to use VBA in Access 2000 to scroll my list boxes so the selected record is in view. I am running a process that updates some fields shown on the list after a user has...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.