private void ServerVersionTextBox4_KeyPress(object sender, KeyPressEventArgs e) { if (!e.KeyChar.ToString(CultureInfo.CurrentCulture).IsNumber(false) && e.KeyChar != (Char)Keys.Back) { ConfigToolTip.SetToolTip(ServerVersionTextBox4, "This box may only contain numbers."); ConfigToolTip.ToolTipIcon = ToolTipIcon.Error; ConfigToolTip.ToolTipTitle = "Numbers Only"; e.Handled = true; } else { ConfigToolTip.RemoveAll(); } }
private void DatabasePortTextBox_TextChanged(object sender, EventArgs e) { if (DatabasePortTextBox.Text.IsNumber(false)) { Int32 port; Int32.TryParse(DatabasePortTextBox.Text, out port); if (port > 65535) { ConfigToolTip.SetToolTip(DatabasePortTextBox, "You must set a valid range from 1 to 65535."); ConfigToolTip.ToolTipIcon = ToolTipIcon.Error; ConfigToolTip.ToolTipTitle = "Invalid Port Range"; ListenPortTextBox.Text = @"3306"; } else { ConfigToolTip.RemoveAll(); } } }