Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / March 2004

Tip: Looking for answers? Try searching our database.

Selecting Listview Rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff - 30 Mar 2004 04:26 GMT
Hi -

I'm having a problem programmatically selecting listview items.

I have a listview (Details view) with 59 rows, showing 7 visible rows.
My first selection runs fine, but my second selection throws a native
exception.  For example, the following 4 statements run fine:

frmlist.lvwList.Items(9).Focused=True
frmlist.lvwList.Items(9).Selected=True
frmlist.lvwList.EnsureVisible(9)
frmlist.lvwList.Refresh

But if I try to repeat the process, I get the exception on the
selected statement:

frmlist.lvwList.Items(25).Focused=True
frmlist.lvwList.Items(25).Selected=True

The error (displayed on the emulator screen) is:

"A Native exception has occurred in MyApp.exe.  Select Quit and then
restart this program, or select Details for more information."

(If I select the Details button, nothing happens.)  Quit terminates
the session.

What am I doing wrong??

Thanks for your help.

- Jeff
Tim Wilson - 30 Mar 2004 06:03 GMT
Are you trying to do multi-selection or just single-selection? I have tried
code similar to the code you posted and I do not see an issue. You might
need to post more of a complete picture as to what you are trying to do. In
addition, I don't specifically remember and issue like this but if you are
not already you may consider moving to CF SP2 to see if that helps at all.
http://www.microsoft.com/downloads/details.aspx?FamilyID=10600643-09b3-46d8-ba28
-bc494bc20d26&DisplayLang=en


Signature

Tim Wilson
.Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}

> Hi -
>
[quoted text clipped - 28 lines]
>
> - Jeff
Jeff - 31 Mar 2004 18:35 GMT
Thanks Tim -

I think I've resolved the problem.  I had been using the
SelectedIndexChanged event to trigger my code, and I should have been
using ItemActivate.

- Jeff

> Are you trying to do multi-selection or just single-selection? I have tried
> code similar to the code you posted and I do not see an issue. You might
[quoted text clipped - 35 lines]
> >
> > - Jeff

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.