Hello,
I am using the UltraWingrid in my application. I had a decimal column that can be negative and Wingrid is displaying the -ve value like-> -10.50 corectly.
Suppose I want to enter some negative value or just want to change the 5.25 to -5.25. I am not able to do this because it is not allowing to enter the -ve sign.
Please help me on this.
Hello Manish,
I am still following your thread. Did you solve your issue by using the "UltraGridColumn" MaskInput property ? If not please do not hesitate to contact us and we wil find a solution that will meet your technical requirements.
A possible approach to achieve what you need is to use the "UltraGridColumn" MaskInput Property. For more details about it you could check this link to our documentation:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2013.1/CLR4.0/html/Infragistics4.Win.UltraWinGrid.v13.1~Infragistics.Win.UltraWinGrid.UltraGridColumn~MaskInput.html
Please feel free to contact us if you still have question on this matter.
Hello Kaloyan ,
Thanks for your immediate response. Actually I had handled the keypress events of the grid and restricted the characters apart from the '.', Thats why it was not working. Now, I had corrected my earlier code and now it is working.
I had used below code to allow only the number,decimal sign, negative sign and bachspace on edit. Please let me know if there any simple solution available for allowing only decimal value(numbers,decimal sign,backspace and negative sign).
//To allow only numbers,negative sign '-', decimal '.' and bachspace key characters.
private void servicesGrid_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsDigit(e.KeyChar)) { this.isAllowedCharKeyPressed = e.KeyChar == '.' || e.KeyChar == '-';
if (e.KeyChar == '\b' || this.isAllowedCharKeyPressed) e.Handled = false; else e.Handled = true; } }
//to handle the error if user presses the Negative Sign '-' key between the numbers. private void servicesGrid_CellDataError(object sender, Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs e) { if (!e.ForceExit) { e.RaiseErrorEvent = false; if (this.servicesGrid.ActiveCell.Column.DataType == typeof(decimal)) { if (this.isAllowedCharKeyPressed) { e.RestoreOriginalValue = true; e.StayInEditMode = true; return; }
} } else { e.RaiseErrorEvent = false; e.StayInEditMode = false; } }
Regards,
Manish
I am still following your thread.
If you still have any other question with this matter please do not hesitate to contact us.
Hello Manish Rai,
Thank you for posting in the Infragistics forums.
I created and attached a sample based on the information that you provided and it is working fine on my machine using NetAdvantage for Windows Forms 2013 vol1. I'm able to enter "-" sign. Could you please upload a sample in which your issue is reproducible or try to modify the sample attached in this thread according to your specific requirements?
Please feel free to let us know if you have any other questions with this matter.