I have an odd problem which I'm not sure how to fix. I have an event wired to the datagrid, on the double click, so something like..
Private Sub mydatagrid_CellDoubleMouse
l sender As Object, ByVal e As System.Windows.Forms.DataG
tArgs) Handles mydatagrid.CellMouseDouble
What the code in the event does is figure out which cell they clicked on, and take the value and then look up that record on a website. The whole time it is looking up the record (due to the delay of web this could take 5 seconds) any movement of the mouse causes multiple cells to hilite along wherever the mouse goes.
So I've been trying to think of ways to stop this behaviour, and it seems like I have to find a way to let the double click event end, like immediatly, and then run my code to open the web pages.
I tried to do this with something like:
er, e) 'I have posted the code for ClearAllOtherSelected Below
..but what I discovered is that simply raising an event from an event doesn't cause the first event to finish, but rather everything is asyncronous. I'm not sure then what I should do, but does anyone have any ideas? I'm hesitant to set up all the web code on a different thread, because there are so many functions and subs involved, I'm not sure how I'd like to handle it, plus if they double click any other record while the other thread is running, and I try to start yet another instance, which would mean another instance of my web form (which is a form hosting a webbrowser), what will it do? I kinda really only want it to be looking up one at any given time.
Any ideas? Thanks! ~Michael
Private Sub mydatagrid_CellDoubleMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles mydatagrid.CellMouseDoubleClick
RaiseEvent EP_myDataGrid_DblClick(sender, e)
Private Sub EventProc_myDataGrid_DblClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles Me.EP_myDataGrid_DblClick
Dim colName$, parcelNum$, county$
If e.ColumnIndex = -1 And e.RowIndex > -1 Then
'This occurs when they double-click on the absolute left-most column (Not data)
'we can open the single record view form
SingleRecView.flagCameFromDGDblClick = True
btnSRV_Click(sender, New System.EventArgs)
ElseIf e.RowIndex < 0 Or e.ColumnIndex < 0 Then
'This occurs any time when they double-click somewhere that isn't data
'Otherwise If it's a Parcel, Send it off to the Web
colName = Me.mydatagrid.Columns(e.ColumnIndex).Name
If colName.ToUpper() = "PARCEL" Then
parcelNum = nz(Me.mydatagrid.Rows(e.RowIndex).Cells("Parcel").Value)
county = UCase(nz(Me.mydatagrid.Rows(e.RowIndex).Cells("County").Value))
If parcelNum <> "" And county <> "" Then
Private Sub ClearAllOtherSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs)
'Line should prevent cells from all hiliting while web is loading
Me.mydatagrid.Rows(e.RowIndex).Cells(e.ColumnIndex).Selected = True
Catch ex As Exception
'this happens when they switch to the singlerecview while the webpage is loading