How do i add a delete button to a datagrid in a windows application?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amitthakkar
    New Member
    • Jul 2010
    • 1

    How do i add a delete button to a datagrid in a windows application?

    i am building a windows form application.
    i have a datagrid that's showin al the rows.
    i haev the update and add buttons separately.. but i want a delete button embedded inside each row at the end.

    Help!
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    I don't know that you can... I think the DataGrid control is self-contained, you might not be able to.

    That said, you could look into making a custom control and overriding the paint event (if you can) in order to place buttons in the location you want. This wouldn't really be a trivial thing and would certainly take some doing.

    Google for creating user controls in C# and overriding the paint event for more information.

    Comment

    • maddyromeo
      New Member
      • Jul 2010
      • 22

      #3
      TextBox and Bool columns can be embed in DataGrid directly from the classes provided by "DataGridTextBo xColumn" class and "DataGridBoolCo lumn"
      class respectively from the .net library classes.

      To get the Button column in a DataGrid you have to write your own class by subclassing the abstract "DataGridColumn Style" like

      public class DataGridTextBox Column : DataGridColumnS tyle

      and you must implement atleast 8 methods,,

      for more information visit




      /////////////
      this answer is upto my knowledge..plea se excuse for any mistakes made....

      Comment

      Working...