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
1465
How to set Min/Max value of a cell
posted

Hello.

I know that the MinValue and MaxValue can be set on a column level, but how do you set it on a cell level?

I've managed a workaround by setting those properties on the column in the "BeforeEnterEditMode" event, but I'm not sure that that's the best way (see code, below).

Is there a better way?

Thanks in advance,

Mike

 

 

 

 

 

Private Sub ugIncludedItems_BeforeEnterEditMode(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles

ugIncludedItems.BeforeEnterEditMode

ugIncludedItems.ActiveCell.Column.MaxValue =

 

 

CInt(ugIncludedItems.ActiveCell.Row.Cells("MAXQTY"

).Value)

ugIncludedItems.ActiveCell.Column.MinValue = 0

 

 

 

End

Sub

Parents
No Data
Reply
  • 20872
    Offline posted

    Hello,

    If you are following this approach you are setting MinValue and MaxValue on the column level and not on the cell level.

    So you probably have to remove the style of the column and set an editor with the appropriate settings on each cell in the IntializeRow event like :

    Private Sub ultraGrid1_InitializeRow(sender As Object, e As InitializeRowEventArgs)
     Dim unE As New UltraNumericEditor()
     e.Row.Cells("DesiredColumn").EditorComponent = unE
     unE.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter
     unE.MaxValue = e.Row.Cells("MaxValueColumn").Value
    End Sub
     

    Please let me know if you have any further questions.

     

Children