Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-02-2009
Member
 
Join Date: Jan 2009
Posts: 38
Disable cell validation on form DataGridView

Hi,
Some of the columns in my database have format = N2
DataSource is an ArrayList.
I dot want any validation if someone enters invalid value in the column Since it gives problem when i try to close the window in such case.
So how can i disable this validation? Don't want to use any close button too.

Please help.
Reply With Quote
  #2  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 115
Re: Disable cell validation on form DataGridView

Did you try catching the Form Closing event and setting EventArgs Cancel
value to false?

http://msdn2.microsoft.com/en-us/library/ms229603.aspx
Reply With Quote
  #3  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 63
Re: Disable cell validation on form DataGridView

Try something like this:

Code:
Private Sub EquipmentValidationByCell(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles dgvEquipment.CellValidating

strCellESN = e.FormattedValue

If dgvEquipment.Columns(e.ColumnIndex).Name = "ESNDataGridViewTextBoxColumn" Then

If EquipmentNumberValidation(strCellESN) Then

dgvEquipment.Rows(e.RowIndex).ErrorText = "Invalid ESN - please correct"

e.Cancel = True

End If

End If

End Sub
Hope this helps you!
Reply With Quote
  #4  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 40
Re: Disable cell validation on form DataGridView

That's exactly what the CellValidating event is for. You're supposed to set e.Cancel to True if the data fails validation and that prevents the data being committed.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Disable cell validation on form DataGridView"
Thread Thread Starter Forum Replies Last Post
Avoid Copy paste over Data Validation cell Bryant Software Development 7 15-07-2011 10:44 AM
How to use Form Validation in JavaScript? Dilbert Software Development 4 30-01-2010 08:30 PM
Problem of javascript and form with validation key entry Sandy22 Software Development 3 16-10-2009 04:51 PM
How to use datagridview readonly cell Ground 0 Windows Software 3 29-07-2009 12:44 PM
How to resize cell in DataGridView Ebadaah Software Development 3 10-06-2009 06:54 PM


All times are GMT +5.5. The time now is 01:17 AM.