Dear Sir
I'm trying to check a cell that is empty and has a value of 0 then cannot addnew row from bindingsource to datagridview with method ProcessCmd
but below code only for empty and column edit or not readonly productname position cell (1) dan Qty position cell (5).
Please Guide me
Thanks
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
If keyData = Keys.Tab AndAlso CBool(Keys.Enter) Then
Dim SelectDgv = GetSELECT()
If Me.Datagridview1.Rows.Count > 0 Then
If Not Datagridview1.CurrentRow.Cells.Cast(Of DataGridViewCell).Any(Function(cell) String.IsNullOrEmpty(cell.FormattedValue?.ToString())) Then
BindingSource1.AddNew()
Else
Datagridview1.CurrentCell = Datagridview1.CurrentRow.Cells("PRODUCTNAME")
Datagridview1.BeginEdit(False)
End If
Else
End If
Return True
ElseIf keyData = Keys.F1 AndAlso CBool(Keys.Enter) Then
Datagridview1.CurrentCell = Datagridview1.CurrentRow.Cells("QTY")
Datagridview1.BeginEdit(False)
Else
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function