private void ListenButtonClick(object sender, EventArgs e) { try { ServerView view = new ServerView(hostTextBox.Text, (ushort)portField.Value); } catch (InvalidCastException) { MessageBox.Show("The port value you entered was either too low or too high."); } }