using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace VisualComponentsLib { public partial class UserTextBox : UserControl { public string inputString { get => textBox.Text; set => textBox.Text = value; } public new event EventHandler? TextChanged { add => textBox.Text = value.ToString(); remove => textBox.Text = string.Empty; } public UserTextBox() { InitializeComponent(); } public void clickCheckBox() { if(checkBox.Checked) { textBox.ReadOnly = true; inputString = string.Empty; textBox.Text = string.Empty; } if(!checkBox.Checked) { try { double support; if (Double.TryParse(textBox.Text, out support)) { inputString = textBox.Text; } } catch (Exception ex) { MessageBox.Show("Введённое значение не является вещественным числом."); } } } } }