This is a migrated thread and some comments may be shown as answers.

ListView dispose in Double Click

6 Answers 169 Views
ListView
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 03 Sep 2015, 07:56 AM

Hello,

 

I noticed that when I try to dispose a ListView control from its own double click event the application crashes.

The control can be disposed from any other source (e.g. a button click) and this behavior occurs even on an empty List View.

Am I doing something wrong or is this a bug?

 

Thanks.

6 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 Sep 2015, 12:44 PM
Hello George,

Thank you for writing.

When the RadListView is double clicked, an item is selected. This happens when the mouse button is released (the MouseUp event) and if the control is there will be no items and an exception will occur. Generally you should not manually dispose any controls or components. They will be when their parent form is . Detailed information is available here: c# - Winforms Disposing IDisposable.

I hope this will be useful.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
George
Top achievements
Rank 1
answered on 03 Sep 2015, 12:51 PM

Hello and thanks for your reply.

I am trying to change the icon of a node in a treeview by opening a user control that contains a listview with icons.

This user control closes (with dispose) on deactivate event.

What I was trying to do is to select the icon with double click, do the appropriate actions for the selection and then close the user control.

 

At the moment I am selecting the icon in the listview and press a button to set the action and dispose the control.

Is there any way I can do it with double click?

 

Thanks.

 

0
George
Top achievements
Rank 1
answered on 03 Sep 2015, 12:54 PM
At the moment I am selecting the icon in the listview and press a button to set the Icon *
0
Dimitar
Telerik team
answered on 04 Sep 2015, 01:48 PM
Hi George,

Thank you for writing back.

As I have mentioned before you do not need to manually dispose the controls. Or at least you should do that when you are sure that the control is no longer needed (when the form is closed for example).

I hope this information helps.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
George
Top achievements
Rank 1
answered on 07 Sep 2015, 06:21 AM

Hello again.

 

Even if I am not disposing any control or form the same behavior occurs when I am trying to programmatically close a form.

This is the case:

Press a button, open a new form with a listview.

The listview has a double click event with Me.close.

When I double click the listview the program crashes.

I do not manually dispose anything.

 

How can I make this work?

Thanks.

0
Dimitar
Telerik team
answered on 08 Sep 2015, 07:49 AM
Hello George,

Thank you for writing back.

I was able to reproduce the case where the exception occurs. It is happening because the item is retrieved when the MouseUp event occurs. Since it occurs after the DoubleClick event the item cannot be retrieved because the form is already closed. This is considered an issue and I have logged it in our Feedback Portal. You can track the item for status changes and add your vote for it here.

To workaround the issue you can use the ItemMouseDoubleClick event instead.

Your Telerik Points have been updated for this report.

Should you have any other questions do not hesitate to ask.


Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
George
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
George
Top achievements
Rank 1
Share this question
or