using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace FCC_Uber_MDX_Configurator { public partial class TextInputForm : Form { public string _returnText = ""; bool _p = true; public TextInputForm(string _inputTitle, string _inputText, bool allowPeriods) { InitializeComponent(); this.Text = _inputTitle; TXT_TEXT.Text = _inputText; _p = allowPeriods; } private void BTN_SAVE_Click(object sender, EventArgs e) { SaveME(); } private bool SaveME() { _returnText = TXT_TEXT.Text; if (_returnText != "") { this.DialogResult = DialogResult.OK; return true; } else { this.DialogResult = DialogResult.None; return false; } } private void TextInputForm_FormClosing(object sender, FormClosingEventArgs e) { if (!SaveME()) { e.Cancel = true; } } private void TXT_TEXT_KeyDown(object sender, KeyEventArgs e) { if (!_p && (e.KeyData == Keys.OemPeriod || e.KeyData == Keys.Decimal)) { e.SuppressKeyPress = true; } return; } } }