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

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.

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

Use DoubleClick event instead of MouseDoubleClick.

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.

wrinkler,

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

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.