Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1650
Cell Min/Max Values
posted

I have a grid that is dynamically built cell by cell.  Each row contains a Label cell, a operator cell(=,<>, >, etc.), and a value column.  The value column can be a string, number, date, etc. As I build the grid I am setting the

Grid.Rows(Count).Cells("EditValue").Column.MinValue to a number

Grid.Rows(Count).Cells("EditValue").Column.MaxValue to a number

However the value is not being validated or maintained in the BeforeCellDeactivate event. When I check the Grid.ActiveCell.Column.MinValue it is not what I set it too.

 

Any ideas how to validate a cells input against a min/max value?

  • 469350
    Suggested Answer
    Offline posted

    The MinValue and MaxValue are on the column, not the cell. The Column property of the cell is simply a backward pointer to the Column to which the cell belongs. There's no way to set a MinValue/MaxValue on an individual cell basis.

    Perhaps what you could do is add a couple more columns for MinValue and MaxValue. You can hide these columns using the Hidden property. Then you can use BeforeCellUpdate to validate the data in the value cell against the MinValue and MaxValue cells in the same row.