CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    101

    Add a Button to a DataGrid

    How do I add Buttons to a DataGrid? Keeping in mind that the DataGrid may have 5 records, 10 records or perhaps only 1 record.

    I basically wish to add a column of buttons to any possible amount of records in a DataGrid.

    Is this possible?

  2. #2
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    1,475

    Re: Add a Button to a DataGrid

    What you are trying to accomplish is quite difficult. Here is a link that might help:
    http://www.codeproject.com/cs/miscct...ridColumns.asp
    However the implementation there is with two images and not buttons.

    I would recommend putting one button outside the grid, which correspond with the current selected row in the grid. This will be an easier user interface, more comfortable, prettier and less complex to create. You will also avoid the need for a dummy column in the table.
    However, I may think of scenarios that I would prefer a column of buttons, but those are very rare.

  3. #3
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    101

    Re: Add a Button to a DataGrid

    Thanks for that jhammer. I will go down the path of the button that corresponds to the selected row in the datagrid.

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