|
-
Oct 25th, 2013, 12:49 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Prevent DataGridView Select Row From Executing Cell Mouse Click Routines
I have various routines that are executed when you click in a particular cell, how do i prevent the routines from executing when i click on the select row button on the far left of the DGV?

regards
toe
-
Oct 25th, 2013, 04:01 AM
#2
Re: Prevent DataGridView Select Row From Executing Cell Mouse Click Routines
All the cell-related events of the DataGridView provide a ColumnIndex and a RowIndex. You test the ColumnIndex and don't do anything unless its the index of a column for which you want to do some processing.
-
Oct 25th, 2013, 04:12 PM
#3
Re: Prevent DataGridView Select Row From Executing Cell Mouse Click Routines
Are you using CellContentClick or Mouse Events? the arguments are a bit different on either one
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
Oct 25th, 2013, 06:23 PM
#4
Thread Starter
Frenzied Member
Re: Prevent DataGridView Select Row From Executing Cell Mouse Click Routines
DataGridView.CellEnter
since you mentioned it i did try "DataGridView.MouseEnter" but pretty much the same result
Code:
Private Sub PaymentsDataGridView_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PaymentsDataGridView.MouseEnter
If PaymentsDataGridView.CurrentRow.Cells(2).Selected Then
paymentsDescriptions.Show()
End If
End Sub
-
Oct 26th, 2013, 01:11 AM
#5
Re: Prevent DataGridView Select Row From Executing Cell Mouse Click Routines
Odd, cellEnter should not be triggered when you select the row headers.
More important than the will to succeed, is the will to prepare for success.
Please rate the posts, your comments are the fuel to keep helping people
-
Oct 26th, 2013, 06:34 PM
#6
Thread Starter
Frenzied Member
Re: Prevent DataGridView Select Row From Executing Cell Mouse Click Routines
This seems to be the event to use
Code:
Private Sub PaymentsDataGridView_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles PaymentsDataGridView.CellContentClick
*EDIT
incorrect as will not fire cell events when there is no content in the cell
Last edited by toecutter; Oct 26th, 2013 at 06:40 PM.
-
Oct 26th, 2013, 11:59 PM
#7
Thread Starter
Frenzied Member
Re: Prevent DataGridView Select Row From Executing Cell Mouse Click Routines
got it with this
Code:
If PaymentsDataGridView.CurrentCell.ColumnIndex = (2) Then
Dim intCurrentCol2 As Integer = Nothing
Dim intCurrentRow2 As Integer = Nothing
intCurrentCol2 = PaymentsDataGridView.CurrentCell.ColumnIndex
intCurrentRow2 = PaymentsDataGridView.CurrentCell.RowIndex
PaymentsDataGridView.Rows(intCurrentRow2).Cells(intCurrentCol2).Selected = True
paymentsDescriptions.Show()
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|