7 Answers, 1 is accepted
0
Hello Chubi,
Thank you for writing.
You can achieve such behavior by using the TextChanging event of the inner text box. Here is a sample code:
Attached you can find a sample project, which demonstrates this functionality.
I hope this helps.
All the best,
Plamen
the Telerik team
Thank you for writing.
You can achieve such behavior by using the TextChanging event of the inner text box. Here is a sample code:
this.radDropDownList1.DropDownListElement.EditableElement.TextBox.TextBoxItem.TextChanging += new Telerik.WinControls.TextChangingEventHandler(TextBoxItem_TextChanging);void TextBoxItem_TextChanging(object sender, Telerik.WinControls.TextChangingEventArgs e){ e.Cancel = e.NewValue.Any(character => !char.IsNumber(character));}Attached you can find a sample project, which demonstrates this functionality.
I hope this helps.
All the best,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Chubi
Top achievements
Rank 1
answered on 20 Feb 2013, 06:28 AM
Mr. Plamen
Thank you for You reply.
And here I would like to get VB.net(2010) Code but not C# or other
Thanking you again for your valuable reply..
Thank you for You reply.
And here I would like to get VB.net(2010) Code but not C# or other
Thanking you again for your valuable reply..
0
Hi Chubi,
Here is the VB version of the code snippet:
In future, if you need such to convert code from C# to VB and vice versa, you can try our free online converter at: http://converter.telerik.com/.
I hope this helps.
Kind regards,
Stefan
the Telerik team
Here is the VB version of the code snippet:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load AddHandler RadTextBox1.TextBoxElement.TextBoxItem.TextChanging, AddressOf TextBoxItem_TextChanging End Sub Private Sub TextBoxItem_TextChanging(sender As Object, e As Telerik.WinControls.TextChangingEventArgs) e.Cancel = e.NewValue.Any(Function(character) Not Char.IsNumber(character)) End SubIn future, if you need such to convert code from C# to VB and vice versa, you can try our free online converter at: http://converter.telerik.com/.
I hope this helps.
Kind regards,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Chubi
Top achievements
Rank 1
answered on 20 Feb 2013, 07:05 AM
Mr.Stefan
Thank you for You reply.
I Used your free tool 'telerik converter' to convert first code which you have given, but I am getting Error (It is not converted).
And about your reply, I need Codes for "RadDropDownList" not for "RadTextBox1"
I have made one modification in your code as given below...
Changed To..
"AddHandler RadDropDownList1
.DropDownListElement.EditableElement.TextBox.TextBoxItem.TextChanging, AddressOf TextBoxItem_TextChanging"
its ok..
but getting error near code "e.NewValue.Any" (e.Cancel = e.NewValue.Any(Function(character) Not Char.IsNumber(character)))
VB Says " 'Any' is not a member of string. "
Pleas give your valuable reply.
Thank you for You reply.
I Used your free tool 'telerik converter' to convert first code which you have given, but I am getting Error (It is not converted).
And about your reply, I need Codes for "RadDropDownList" not for "RadTextBox1"
I have made one modification in your code as given below...
"AddHandler RadTextBox1.TextBoxElement.TextBoxItem.TextChanging, AddressOf TextBoxItem_TextChanging"
Changed To..
"AddHandler RadDropDownList1
.DropDownListElement.EditableElement.TextBox.TextBoxItem.TextChanging, AddressOf TextBoxItem_TextChanging"
its ok..
but getting error near code "e.NewValue.Any" (e.Cancel = e.NewValue.Any(Function(character) Not Char.IsNumber(character)))
VB Says " 'Any' is not a member of string. "
Pleas give your valuable reply.
0
Hi Chubi,
Please excuse me for the confusion. The error you are getting is because you are using a .NET version prior .NET3.5. Here is the code for versions where lambdas are not supported:
I hope this helps.
All the best,
Stefan
the Telerik team
Please excuse me for the confusion. The error you are getting is because you are using a .NET version prior .NET3.5. Here is the code for versions where lambdas are not supported:
Private Sub TextBoxItem_TextChanging(sender As Object, e As Telerik.WinControls.TextChangingEventArgs) 'e.Cancel = e.NewValue.Any(Function(character) Not Char.IsNumber(character)) e.Cancel = Not IsNumeric(e.NewValue) End SubI hope this helps.
All the best,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Chubi
Top achievements
Rank 1
answered on 22 Feb 2013, 02:35 PM
Hello Stefan,
I did as u said, but I can't enter the number except in the format given in code snippet ("0123456789"), I mean I Can enter only in ascending order not any other numbers(example: 1324, 156, 10). And I am using .net framework version 4
Hope I will get the Solution
I did as u said, but I can't enter the number except in the format given in code snippet ("0123456789"), I mean I Can enter only in ascending order not any other numbers(example: 1324, 156, 10). And I am using .net framework version 4
Hope I will get the Solution
0
Hi Chubi,
Please excuse me for the misunderstanding. I have updated the code snippet in my previous post and it should be working correctly now.
As to the lambdas, I am not sure why it does not work in your case. The error you have provided is raised when the framework version is less than 3.5. With 3.5 and 4.0 I am able to use it. See attached video (opens in browser).
All the best,
Stefan
the Telerik team
Please excuse me for the misunderstanding. I have updated the code snippet in my previous post and it should be working correctly now.
As to the lambdas, I am not sure why it does not work in your case. The error you have provided is raised when the framework version is less than 3.5. With 3.5 and 4.0 I am able to use it. See attached video (opens in browser).
All the best,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
