Results 1 to 3 of 3

Thread: [2005] Validating DataGridView's cell

Threaded View

  1. #1

    Thread Starter
    Addicted Member sweet_dreams's Avatar
    Join Date
    Apr 2005
    Location
    Poland, Lodz
    Posts
    189

    Question [2005] Validating DataGridView's cell

    Hi,

    How can I valide value in DataGridViews cell? I was trying to do it like that:

    VB Code:
    1. Private Sub DataGridView1_CellValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles DataGridView1.CellValidating
    2.    
    3.         If Me.DataGridView1.CurrentCellAddress.X = 1 Then
    4.             If Not IsNumeric(Me.DataGridView1.CurrentCell.Value) Then
    5.                 e.Cancel = True
    6.                 MessageBox.Show("cell contains wrong value")
    7.             End If
    8.         End If
    9.     End Sub

    But this code returns error regardless of value that was entered into cell.

    Please help,

    Regards,
    sweet_dreams
    Last edited by sweet_dreams; Aug 29th, 2006 at 12:44 PM.
    using VB 2010 .NET Framework 4.0; MS Office 2010; SQL Server 2008 R2 Express Edition | Remember to mark resolved threads and rate useful posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width