|
| |||||||||
| Tags: arraylist, cell, column, datagrid view, datasource, format |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| 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. |
|
#2
| |||
| |||
| 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 |
|
#3
| ||||
| ||||
| 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 |
|
#4
| |||
| |||
| 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. |
![]() |
|
| Thread Tools | Search this Thread |
| |
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 11: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 05:51 PM |
| How to use datagridview readonly cell | Ground 0 | Windows Software | 3 | 29-07-2009 01:44 PM |
| How to resize cell in DataGridView | Ebadaah | Software Development | 3 | 10-06-2009 07:54 PM |