I got it.
First, need to format the column as currency
Code:
DataGridView1.Columns("C").DefaultCellStyle.Format = "c"
Next, add eventhandler for cells
Code:
Private Sub dataGridView1_EditingControlShowing(ByVal sender As Object, _ ByVal e As DataGridViewEditingControlShowingEventArgs) _ Handles DataGridView1.EditingControlShowing Dim txtEdit As TextBox = e.Control RemoveHandler txtEdit.KeyPress, AddressOf txtEdit_Keypress AddHandler txtEdit.KeyPress, AddressOf txtEdit_Keypressend sub
And, in txtedit_keypress,
Code:
Private Sub txtEdit_Keypress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
If e.KeyChar = "-" Then
Dim curCell As DataGridViewCell = DataGridView1.CurrentCell
If curCell.ColumnIndex = 2 Then
curCell.Value = -CDec(curCell.Value)
DataGridView1.RefreshEdit()
e.Handled = True
End If
End If
end sub
This will work as desired.