Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Datagridview - how to identify Top Left Corner Select All cell?

12 views
Skip to first unread message

Rich

unread,
May 11, 2007, 3:05:01 PM5/11/07
to
In a datagridview, the first column header cell is columnHeader(0), which is
immediately to the right of the Top Left Corner Select All cell. And the
first RowHeader cell is RowHeaderCell(0) which is immediately below the Top
Left Corner Select All cell.

When clicking on the Top Left Corner SelectAll cell, which selects all the
Rows/columns in the datagridview, the only event that appears to fire is the
SelectionChanged event. But that event fires for just about anything. How
can I isolate/identify when it was the Top Left Corner SelectAll cell that
was clicked?

Thanks,
Rich

charlieopenshaw

unread,
Dec 21, 2009, 5:42:04 AM12/21/09
to
private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);

if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{
//Do something here
}
}

Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?
11-May-07

Thanks,
Rich

Previous Posts In This Thread:

On Friday, May 11, 2007 3:05 PM
Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?

Thanks,
Rich

On Wednesday, February 18, 2009 10:21 AM
Olaf Stelling wrote:

Datagridview - how to identify Top Left Corner Select All cell?
You can superimpose a button on that corner cell and make it blend in with the DG so nobody knows it is there. I use it to toggle between SelectAll and ClearSelection.

On Monday, December 21, 2009 5:40 AM
Charlie Openshaw wrote:

Use the click event
Try this:

private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);
if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{

// do something here

}
}

On Monday, December 21, 2009 5:41 AM
Charlie Openshaw wrote:

DataGridView click top left cner
private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);

if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{
//Do something here
}
}


Submitted via EggHeadCafe - Software Developer Portal of Choice
Remote Scripting ("AJAX") Zipcode UserControl/Map
http://www.eggheadcafe.com/tutorials/aspnet/e796203a-5866-4868-b3e5-af32575944d9/remote-scripting-ajax.aspx

charlieopenshaw

unread,
Dec 21, 2009, 5:40:12 AM12/21/09
to
Try this:

private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);
if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{

// do something here

}
}

Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?
11-May-07

Thanks,
Rich

Previous Posts In This Thread:

On Friday, May 11, 2007 3:05 PM
Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?

Thanks,
Rich

On Wednesday, February 18, 2009 10:21 AM
Olaf Stelling wrote:

Datagridview - how to identify Top Left Corner Select All cell?
You can superimpose a button on that corner cell and make it blend in with the DG so nobody knows it is there. I use it to toggle between SelectAll and ClearSelection.

Submitted via EggHeadCafe - Software Developer Portal of Choice

ASP.NET 2.0 Page LifeCycle
http://www.eggheadcafe.com/tutorials/aspnet/6fe3d066-d804-466c-969f-2346b5167887/aspnet-20-page-lifecycl.aspx

charlieopenshaw

unread,
Dec 21, 2009, 5:41:45 AM12/21/09
to
private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);

if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{
//Do something here
}
}

Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?
11-May-07

Thanks,
Rich

Previous Posts In This Thread:

On Friday, May 11, 2007 3:05 PM
Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?

Thanks,
Rich

On Wednesday, February 18, 2009 10:21 AM
Olaf Stelling wrote:

Datagridview - how to identify Top Left Corner Select All cell?
You can superimpose a button on that corner cell and make it blend in with the DG so nobody knows it is there. I use it to toggle between SelectAll and ClearSelection.

On Monday, December 21, 2009 5:40 AM
Charlie Openshaw wrote:

Use the click event
Try this:

private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);
if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{

// do something here

}
}


Submitted via EggHeadCafe - Software Developer Portal of Choice

Dr. Dotnetsky's Cool .NET Tips and Tricks # 14
http://www.eggheadcafe.com/tutorials/aspnet/b4e6c9d9-cd07-46ed-a8a2-ed2717076759/dr-dotnetskys-cool-net.aspx

charlieopenshaw

unread,
Dec 21, 2009, 5:55:12 AM12/21/09
to
private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);

if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{
// Call sorting method
}
}

Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?
11-May-07

Thanks,
Rich

Previous Posts In This Thread:

On Friday, May 11, 2007 3:05 PM
Ric wrote:

Datagridview - how to identify Top Left Corner Select All cell?

Thanks,
Rich

On Wednesday, February 18, 2009 10:21 AM
Olaf Stelling wrote:

Datagridview - how to identify Top Left Corner Select All cell?
You can superimpose a button on that corner cell and make it blend in with the DG so nobody knows it is there. I use it to toggle between SelectAll and ClearSelection.

On Monday, December 21, 2009 5:40 AM
Charlie Openshaw wrote:

Use the click event
Try this:

private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);
if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{

// do something here

}
}

On Monday, December 21, 2009 5:41 AM
Charlie Openshaw wrote:

DataGridView click top left cner

private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);

if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{
//Do something here
}
}

On Monday, December 21, 2009 5:42 AM
Charlie Openshaw wrote:

DataGridView click top left cner

private void dataGridView1_Click(object sender, EventArgs e)
{
MouseEventArgs args = (MouseEventArgs)e;
DataGridView dgv = (DataGridView)sender;
DataGridView.HitTestInfo hit = dgv.HitTest(args.X, args.Y);

if (hit.Type == DataGridViewHitTestType.TopLeftHeader)
{
//Do something here
}
}

Submitted via EggHeadCafe - Software Developer Portal of Choice

Displaying Popup RTF from embedded Resources
http://www.eggheadcafe.com/tutorials/aspnet/e963940f-f79f-4c18-a801-191b7d398eb0/displaying-popup-rtf-from.aspx

0 new messages