This post - http://tinyurl.com/hy4fg - details the steps to reproduce the error, and as noted you must start with an empty list
and then add a row, tab to the next field and then hit escape. This will raise the error every time.
Any word or resolution for this?
I'm thinking I'll change my datagrid to not automatically add new, but create a button.
Cheers,
Stu
Thank you for posting.
I performed a test based on your sample code and did see the problem you
said. I have looked up in our inner database and found a report about this
problem in it. It's a known bug in Visual Studio 8.0.50727.42. This bug
will be fixed in the next release of Visual Studio.
A probably workaround is to create a new class inherited from DataGridView
and override the OnKeyDown method. The following is a sample for you.
class MyDataGridView : DataGridView
{
protected override void OnKeyDown(KeyEventArgs e)
{
// the keyvalue of Escape key is 27
if (e.KeyValue == 27)
{
if (this.CurrentCell.RowIndex > 0)
{
base.OnKeyDown(e);
}
}
else
{
base.OnKeyDown(e);
}
}
}
Thus, when you edit the first row and tab to the second column and press
Escape, nothing happens. However, the function of Escape is still available
on other rows.
Thank you for reporting this bug to us. If you have anything unclear about
the above workaround, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Cheers,
Stu
Thanks, bye.
Luke
Stuart Carnie ha scritto:
bye, Luke
if (gridTicketRows.Rows.Count == rowsBindingSource.Count){
rowsBindingSource.RemoveAt(rowsBindingSource.Count - 1);
return;
}
gridTicketRows is name of DataGridView, rowsBindingSource is name of
BindingSource.
good luck, :-)
Luke
I haven't get error anymore!
good luck, :-)
Luke
Now my users can do inline datagrid editing without fear!
Here's luca's code in VB.NET, where dgv is an instance of a DataGridView:
Private Sub BindingSrcAddNew(ByVal sender As Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles bindingSrc.AddingNew
If (Me.dgv.Rows.Count = Me.bindingSrc.Count) Then
Me.bindingSrc.RemoveAt(Me.bindingSrc.Count - 1)
End If
End Sub
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com