CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2010
    Posts
    5

    Value from one column but not another

    Hello all,

    I coded a simple application that selects two columns of data from a database into a datagridview. I also made it so that when you double click a row of data, it will open a messagebox and display the value of the particular cell that was clicked on in the grid, such as below:



    That is exactly what I want it to do.

    What I do not want it to do is do that for the "Description" column. I only want it to pull the value from the "Code" column.

    The purpose of this event will be to open another dialog that displays more information about the particular "Code" that was double clicked, not description. I do not want anything to happen by double clicking "Description"

    Thanks for your help and let me know if you need more information.

  2. #2
    Join Date
    Oct 2011
    Posts
    97

    Re: Value from one column but not another

    How are you currently handling the mouse clicks? If you're handling them though the MouseDoubleClick event, I'm willing to bet there's a way to do it there. The MouseEventArgs parameter will give you the location of the mouse click relative to the top-left of the grid control. From there, you can figure out which column is being clicked.

    Would you mind posting the code where you handle the mouse click? Maybe then I could help a bit more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured