RadForm .net framework 4

1 Answer 24 Views
Form TextBox
Gera
Top achievements
Rank 1
Gera asked on 07 Mar 2024, 06:49 AM

I have a custom RadForm class that has inherited over a hundred forms. I have a custom RadTextBox class where I added some validation fired on the LostFocus event. To replace all RadTextBox controls with custom ones are a thousand controls to update, which are not an option.
I am looking for a way to maybe use events on my custom Radform which I can fire on Radtextbox control, it may be a way to update Radtextbox control to a custom one. Maybe other ideas on how I can use custom RadTextBox  control without updating one by one

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 11 Mar 2024, 02:41 PM

Hello, Gera,

There is no out-of-the-box solution for replacing controls with custom ones. If I understand you correctly your custom RadTextBox is a derivate of RadTextBox. Every control used on the form is declared in the Designer.cs file as well and it would be necessary to change the control type with the custom one there. However, you should be very careful if performing such changes since  it is not recommended to manually update the auto-generated code of VS designer.

I made research in general programming forums on this topic. The following threads might be useful:
vb.net - How do you change the type of a WinForms control to a new type that is derived from the original type when using Visual Studio Designer? - Stack Overflow
c# - Change Control Types (but not names) on Form with Minimal Impact - Stack Overflow
C#: What is the proper way to swap winform controls? - Stack Overflow
How to: Add to or Remove from a Collection of Controls at Run Time - Windows Forms .NET Framework | Microsoft Learn

I hope this informaiton is useful. If you have other questions, please let me know.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Form TextBox
Asked by
Gera
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or