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

G

Guest

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
 
C

Charlie Openshaw

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

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

Previous Posts In This Thread:

Datagridview - how to identify Top Left Corner Select All cell?
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

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/tutorial...69f-2346b5167887/aspnet-20-page-lifecycl.aspx
 
C

Charlie Openshaw

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

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

Previous Posts In This Thread:

Datagridview - how to identify Top Left Corner Select All cell?
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

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.

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/tutorial...a8a2-ed2717076759/dr-dotnetskys-cool-net.aspx
 
C

Charlie Openshaw

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

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

Previous Posts In This Thread:

Datagridview - how to identify Top Left Corner Select All cell?
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

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.

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

}
}

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/tutorial...-b3e5-af32575944d9/remote-scripting-ajax.aspx
 
C

Charlie Openshaw

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

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

Previous Posts In This Thread:

Datagridview - how to identify Top Left Corner Select All cell?
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

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.

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

}
}

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
}
}

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/tutorial...1-191b7d398eb0/displaying-popup-rtf-from.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top