title: How to set cell formatting in particular column in datagridview using VB.Net?
body: <p>I am working on with DatagridView tool. Here I am doing a manual entry on columns and save it directly to database. I have 5 columns out of which 3 are alphanumeric and 2 are numeric columns. </p>
  
  <p>I have set condition to for numeric columns using handlers in EditingControlShowing event.</p>
  
  <pre><code>    If grdLedgerDetails.CurrentCell.ColumnIndex = 4 Then
          AddHandler CType(e.Control, TextBox).KeyPress, AddressOf TextBox_keyPress
      ElseIf grdLedgerDetails.CurrentCell.ColumnIndex = 5 Then
          AddHandler CType(e.Control, TextBox).KeyPress, AddressOf TextBox_keyPress
      End If
  
  
  Private Sub TextBox_keyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
      If Char.IsDigit(CChar(CStr(e.KeyChar))) = False Then e.Handled = True
  End Sub
  </code></pre>
  
  <p>This condition works properly. But the problem is that, this condition works on all columns. I just want it to be worked on specified column.</p>
  
  <p>Please help me out from this. </p>
  
  <p>Thanks in advance.</p>