We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MaxValue and MinValue in a GridCurrency cell?

I want to be able to set a maximum/minimum value to a currency edit cell but no appropriate properties are available in GridStyleInfo.CurrencyEdit. There are maxvalues and minvalues properties in the CurrencyTextBox class but i don't know how to access it. Olivier

5 Replies

AD Administrator Syncfusion Team June 25, 2003 08:05 AM

Try using the Maximum and Minimum properties in the style's ValidateValue property. style.CurrencyEdit.PositiveColor = System.Drawing.Color.Black; style.ValidateValue.Maximum = 10000; style.ValidateValue.Minimum = 0;


AD Administrator Syncfusion Team March 7, 2005 04:03 AM

I have the same issue, but I want to handle when user typing a value in a cell. User can not type a value greater than the maximum value ( I don''t like raise an error message). I try using CurrentCellKeyPress event, but I can not handle this issue. Please let me know how to resolve this issue. Thanks, >Try using the Maximum and Minimum properties in the style''s ValidateValue property. > > >style.CurrencyEdit.PositiveColor = System.Drawing.Color.Black; >style.ValidateValue.Maximum = 10000; >style.ValidateValue.Minimum = 0; > >


AD Administrator Syncfusion Team March 7, 2005 05:33 AM

In 3.0.1.0, you can try handling the KeyValidate event on the mebeeded CurrencyEdit control, and canceling that event if the value is not what you want. This event is raised keystroke by keystroke. To subscribe to it, use code like: GridCurrencyTextBoxCellRenderer cr = this.gridControl1.CellRenderers["Currency"] as GridCurrencyTextBoxCellRenderer; GridCurrencyTextBox tb = cr.Control as GridCurrencyTextBox; tb.KeyValidate += new Syncfusion.Windows.Forms.Tools.KeyValidateEventHandler(tb_KeyValidate);


HD Hoang Dinh March 7, 2005 11:53 PM

Are there anyway to control this issue? I''m using version 2.1.0.9.


AD Administrator Syncfusion Team March 8, 2005 04:15 AM

You checked, and this event is not available in 2.1.0.9? It was added in the last 4-5 months, so it may not be in 2.1.0.9. Using this event would be the simplest thing to do if it is available. If it is not available, then the only way I would know to gat at these keystroke soon enough to prevent the keys from being processed is to derive the GridCurrencyTextBoxCellRenderer, GridCurrencyTextBoxCellModel, and GridCurrencyTextBox classes. In the textbox class, you can override ProcessCmdKey and catch keystrokes there. You need to derive the other classes so your can use your derived GridCurrencyTextBox in a cell. This will take some coding, but I think is doable.

Loader.
Live Chat Icon For mobile
Up arrow icon