diff --git a/TelegramBotBase/Base/FormBase.cs b/TelegramBotBase/Base/FormBase.cs index 64180ea..7bffae2 100644 --- a/TelegramBotBase/Base/FormBase.cs +++ b/TelegramBotBase/Base/FormBase.cs @@ -308,6 +308,20 @@ namespace TelegramBotBase.Form this.Controls.Add(control); } + /// + /// Removes control from the formular and runs a cleanup on it. + /// + /// + public async void RemoveControl(ControlBase control) + { + if (!this.Controls.Contains(control)) + return; + + await control.Cleanup(); + + this.Controls.Remove(control); + } + /// /// Cleanup ///