DataGridView.RowPostPaint event, e.RowIndex is out of range



Using C# in VS 2005 SP1 with .Net Framework 2 SP1, I have the following
code:

private void MyDataGridView_RowPostPaint(object sender,
DataGridViewRowPostPaintEventArgs e)
{
DataGridViewRow gridRow = MyDataGridView.Rows[e.RowIndex];
// ....

and it crashes because e.RowIndex is larger than the number of rows in
MyDataGridView.

It's pretty obvious how to code a workaround for this bug, but it seems ...
hmm, maybe no dumber than usual.

.



Relevant Pages

  • Re: OE crashes when replying to certain messages
    ... from the same sender, and they always have attachments. ... crashes OE. ... saying "Outlook Express has encountered ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • OE crashes when replying to certain messages
    ... from the same sender, and they always have attachments. ... crashes OE. ... saying "Outlook Express has encountered ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: What is likely to be HD when ITV launch ITV HD ?
    ... '£' sign sometimes here and also things like 'A0' or summat where it was ... obviously typed as a '£' by the sender. ... via the two email accounts. ... crashes. ...
    (uk.tech.broadcast)
  • Strange Problem
    ... im running the code below when a new item is selected within a combobox the ... code runs fine but when it gets to me.close it crashes - it doesnt start the ... Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Remove current record triangle from DataGridView RowHeader??
    ... Maybe Drawing the Text yourself will give you more control. ... void dataGridView1_RowPostPaint(object sender, ... DataGridViewRowPostPaintEventArgs e) ...
    (microsoft.public.dotnet.framework.windowsforms.controls)