• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

Only Button Column Clickable in Datagridview

How do I make is so that only my button column in my dgv is clickable?  I only have 3 columns and right now the click even fires when you touch anything in the row.

I tried this:

    If e.ColumnIndex = DataGridView1.Columns(3).Index Then
            MsgBox("button column")
        Else
            MsgBox("non button column")

        End If

But the 'button column' message box popped up every time. Perhaps I have to add the button column after and then add code to the buttons? Right now I am using a binding source.

Thanks for any help you can give me on this. I have done this before, I just don't remember where or how.
0
G Scott
Asked:
G Scott
  • 2
1 Solution
 
G ScottAuthor Commented:
Column index 3 obviously being my button column.
0
 
ArkCommented:
why not If e.ColumnIndex = 3 Then...?
But probably

For i=0 to dgv.Columns.Count-1
    if i<>3 Then
       dgv.Columns(i).ReadOnly=true
    End if
Next

is better?
0
 
G ScottAuthor Commented:
This will work. Thanks.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now