473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to the item of listview selected automatically?

yxq
Hello
I want to first item of listview selected automatically, i write the code,
but it does not work.

ListView1.Focus ()
ListView1.Item( 0).Select = True

Thanks
Nov 20 '05 #1
2 12878
Hello,

"yxq" <ga***@163.ne t> schrieb:
I want to first item of listview selected automatically, i write
the code, but it does not work.

ListView1.Focus ()
ListView1.Item( 0).Select = True

Set the ListViewItem's 'Selected' property to 'True'. Notice that you need
not set the focus to the ListView control, you may want to set the ListView
control's 'HideSelection' property to 'False'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2
"yxq" <ga***@163.ne t> wrote in message news:<es******* *******@TK2MSFT NGP09.phx.gbl>. ..
Hello
I want to first item of listview selected automatically, i write the code,
but it does not work.

ListView1.Focus ()
ListView1.Item( 0).Select = True

Thanks


I'm surprised that even compiles.
Do you meen:

ListView1.Focus ()
ListView1.Items (0).Select = True

[Note the "s" at the end of "Items"]
Nov 20 '05 #3

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

Similar topics

0
1170
by: Stanley J Mroczek | last post by:
How do I mark the item that selected in the dropdownlist . the state is is ny and i want to mark was selected on the first page. If Page.IsPostBack = False Then Dim statefile As CustomersDB = New CustomersDB type.DataSource = statefile.GetState type.DataBind()
7
24097
by: GTi | last post by:
I have a listview that with selected items. But I want to "reselect" items after a refresh. Each items have a uniqe value in the Tag object. After a refresh some new items may be added or removed so using item index is not possible. To get the list of selected items I use: ListView.SelectedListViewItemCollection selItems =...
2
1794
by: Eric Jelinek | last post by:
I need a little help here, I have a list view that may contain only a few items. If the size of the listview is larger then what I need to hold the items, and then the user click on whitespace, how can maintain that an item must be selected? Currently in the MouseDown Event I .GetItem(e.X, e.Y) and check to see if it is null, if it is then I...
2
11693
by: martin | last post by:
Hi, I am looking for a method to check if an item (any item) is selected in a particular listbox before deleteing it from my database, however I keep getting errors, The code I have is lbSpecificProgram is a listbox.
4
1984
by: cwoll | last post by:
I am runing this function to toggle buttens to display an "X" when they is selected, the butten is linked to a yes/no field. This function works good, the problem I am having is that when I make a new record the "X" from the last record I looked at are still there, but the bottens are not selected nether should they be. How do I clear every...
3
3602
by: Tiago Salgado | last post by:
I everyone... I've got a listview (details) ... and i'm trying to unselect any item selected... In a combobox, e.g, i can put this: ComboBox1.SelectedIndex = -1 I want to do this but in a listview control... can anyone help me? Thanks
0
1168
by: axas | last post by:
After a deselection of all the items of a listbox, the first item appears selected again. How can I fix it????
4
13843
by: Bill-R | last post by:
I'm trying to convert a vb6 program to vb.net (vb2008 express) I have text data in a Listview Control I use a Textbox to enter characters to search the Listview When a Match is found, I use textbox_textchanged to select listview item Listview1.Items(z).Selected = True Listview1.Items(z).EnsureVisible () Listview1.Items(z).FullRowSelect...
0
5949
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a listview that when I select an item, it populates a details view. I want to show the item that was selected in the listview by changing it to yellow. Trouble is, the selected item does not show as yellow until I've clicked the same item two times. What am I doing wrong on the selected item that keeps it from changing to yellow until...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.