DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   ListView DoubleClick wont fire (http://www.daniweb.com/forums/thread201162.html)

winkler Jul 2nd, 2009 6:07 am
ListView DoubleClick wont fire
 
Hi all, it's my first time in this forum, I hope you can help.
I've searched the web for a long time, couldn't find help, yet.

I have a listview that displays a list of PDF files. When the user clicks on a row (in the "selectedIndexChanged" event), I display the selected PDF underneath the Listview in a Webbrowser control
WebBrowser1.Navigate(sFile)
So far so good.
Additionally, when the user double clicks a row on the ListView (in the "DoubleClick" event), I use
Process.Start(sFile)
where sFile is the name of the PDF file, to open Adobe Acrobat Reader in a separate process.
Now here's the problem: This only works when the user double clicks the currently selected row. If however, the user double clicks on a row that is not selected in the list view, the application produces two "SelectedIndexChanged" events, and no double click event.
What I've discovered is that if I comment out the line
WebBrowser1.Navigate(sFile)
then my code works as expected. A single click produces a "selectedIndexChanged", a double click produces a "selectedIndexChanged" and a "DoubleClick".
So it seems as if calling WebBrowser1.Navigate(sFile) somehow interrupts the events from firing correctly.
Any ideas on how I could solve this issue?
Thank you.
Winkler

adatapost Jul 3rd, 2009 2:45 am
Re: ListView DoubleClick wont fire
 
Welcome winkler,

Event selectedIndexChanged will be fired when index of an item get changed. But with DoubleClick - There is no way to execute selectedIndexChanged.

Please verify your code.

sonia sardana Jul 3rd, 2009 3:13 pm
Re: ListView DoubleClick wont fire
 
hi frnd,if you want on Listview double click then,use the below event

 Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick
          MsgBox ("")
    End Sub

adatapost Jul 3rd, 2009 10:57 pm
Re: ListView DoubleClick wont fire
 
Use DoubleClick event instead of MouseDoubleClick.

winkler Jul 5th, 2009 4:16 am
Re: ListView DoubleClick wont fire
 
Thank you for your ideas. I tried them and they don't work. Any other ideas? Anyone know about simulating a double click event by timing the interval between the clicks?
Thank you.

adatapost Jul 5th, 2009 4:25 am
Re: ListView DoubleClick wont fire
 
wrinkler,

It's not an idea. It's a suggestion and it must has to work.

winkler Jul 7th, 2009 2:37 pm
Re: ListView DoubleClick wont fire
 
Well, thank you for your suggestion, but it did not change anything in my situation.
I did, however, find a different workable solution.
ListView has an "activated" attribute, which, when set to "Two Clicks" activates the selected row on the listview in two clicks. This differs from "DoubleClick" because "Two Clicks" allows for some time to elapse between the two.
I put the Process.Start(sFile) into the ListView1_ItemActivate() event and voila! It works!


All times are GMT -4. The time now is 4:39 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC