Hi Jin,
If you are using C#, you can copy this code snippet:
listView1.Items[0].Selected =true;
Note: C# uses square brackets for indexers.
If it is in VB.NET, then you can use: listView1.Items(0).Selected =true
Please let me know if it can work. Thanks.
Best Regards,
Lewis
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Jin Kim" <
[email protected]>
| Sender: "Jin Kim" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| Subject: RE: Programmatically Selecting An Item in a Listview
| Date: Wed, 30 Jul 2003 07:58:59 -0700
| Lines: 62
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNWqxs0xeNdjOA0SQ2kQPpnkoVYng==
| Newsgroups: microsoft.public.dotnet.framework
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:50132
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.framework
|
| Hi Lewis,
|
| I tried that and got:
|
| (268): 'System.Windows.Forms.ListView.Items' denotes
| a 'property' where a 'method' was expected
|
| Thanks for your help.
| Jin
|
| >-----Original Message-----
| >Thanks Brad for the suggestions.
| >
| >Hello Jin,
| >
| >There is no selectedIndex property in listView, but you
| can use
| >ListViewItem.Selected property to select the item. It can
| work in .net CF.
| >
| >listView1.Items[0].Selected =true;
| >
| >Does this answer your question? Thanks.
| >
| >Lewis
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "Jin Kim" <
[email protected]>
| >| Sender: "Jin Kim" <
[email protected]>
| >| Subject: Programmatically Selecting An Item in a
| Listview
| >| Date: Tue, 29 Jul 2003 09:48:18 -0700
| >| Lines: 5
| >| Message-ID: <
[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcNV8TaeJL5MfQ8bQ1WeWViKHFuPnw==
| >| Newsgroups: microsoft.public.dotnet.framework
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework:50057
| >| NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
| >| X-Tomcat-NG: microsoft.public.dotnet.framework
| >|
| >| I'm trying to select an item in a listview using C#
| >| and .NET Compact Framework. Is there anyway to do this
| by
| >| passing in the index of the item I want selected?
| >|
| >| Thanks
| >|
| >
| >.
| >
|