?
Solved

"access vioaltions" when clicking on TListView

Posted on 2004-11-06
1
Medium Priority
?
198 Views
Last Modified: 2010-04-05
Hi,
i have a TListView on the form. in the onClick event i have this code:
begin
if ListView1.Selected.Index = 0 then ShowMessage('You clicked on the first item');
end;

when i click on the listview (but not on an item) an error accours: access violations at adress 00445F54 in module 'Project1'. Read of address 00000004.

i am using delphi 4.
0
Comment
Question by:din345
1 Comment
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 12513836
try

if assigned(ListView1.Selected) and (ListView1.Selected.Index = 0)
  then ShowMessage('You clicked on the first item');

make sure that one is selected

hope thats it

meikl ;-)
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question