I want to assign a string value to a variable in the DataGridView LostFocus event. I found that I can’t just do variable = "string value, it will give me the “Unable to cast object of type ‘system.eventargs’ to type ‘system.windows.forms.datagridviewcelleventargs’” error.
The function created by double-clicking on the datagridview is:
Private Sub DataGridViewInvoice_LostFocus(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewInvoice.LostFocus
Thanks,
Raymond
That’s the wrong parameters for the .LostFocus event.
Also, maybe you should consider the .Leave event instead, as suggested in the remarks at http://msdn.microsoft.com/en-us/library/system.windows.forms.control.lostfocus%28v=vs.90%29.aspx