We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

DataGridBoolColumn

Thread ID:

Created:

Platform:

Replies:

281 May 21,2002 01:30 PM Windows Forms 0
loading
Tags: FAQ
boB Taylor MCSD, MCDBA, MCSE
Asked On May 21, 2002 01:30 PM

Here is what I wound up with. I think it is a simpler approach. public class SingleClickDataGrid : DataGrid { public SingleClickDataGrid() { this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.GridMouseDown); } public void GridMouseDown(object sender, MouseEventArgs e) { System.Windows.Forms.DataGrid.HitTestInfo hi; // let's see where we clicked... hi = HitTest(e.X,e.Y); // If the user did not click on a cell, we don't care... // we'll just pass on to the base class if(hi.Type == System.Windows.Forms.DataGrid.HitTestType.Cell) { // Get the TableStyles collection DataGridTableStyle dgt = TableStyles[0]; // Get the ColumnStyle for the selected column DataGridColumnStyle myCol = dgt.GridColumnStyles[hi.Column]; // Is this a check box column? // if not, we'll let the base class handle it if(myCol.GetType() == typeof(DataGridBoolColumn)) { // First part of the magic... select the row, so that the edit can happen Select(hi.Row); // Call the grid table style to start and end the edit dgt.BeginEdit(myCol,hi.Row); dgt.EndEdit(myCol,hi.Row,true); } } } }

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;