Only Button Column Clickable in Datagridview

Posted on 2012-09-10
Last Modified: 2012-09-26
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")
            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.
Question by:G Scott
    LVL 1

    Author Comment

    by:G Scott
    Column index 3 obviously being my button column.
    LVL 27

    Accepted Solution

    why not If e.ColumnIndex = 3 Then...?
    But probably

    For i=0 to dgv.Columns.Count-1
        if i<>3 Then
        End if

    is better?
    LVL 1

    Author Closing Comment

    by:G Scott
    This will work. Thanks.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now