Hi guys, Please help! I want the column/cell of my Datagridview to accepts double(1500.50). I declare the cells as TextBoxCell.

'In dgvw_EditingControlShowing event :
 AddHandler tb.KeyPress, New KeyPressEventHandler(AddressOf txtColDgvw_Keypress) 'Calling the Keypress of TextBoxCell
Private Sub txtColDgvw_Keypress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        Try
          If not Char.IsNumber(e.KeyChar) Then e.Handled = True
        Catch ex As Exception
            MsgBox(Err.Description)
        End Try
End Sub

It does not accept Double Or I cannot type a point(.)... please Help... Thank You and God bless you:)

Recommended Answers

All 2 Replies

Your code in line 3 only allows numbers.
You need to change this to allow the '.' too.

yeah... thank you... Got it :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.