Example #1
0
        /// <summary>
        /// Ensure that the IP address range entered is valid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnOK_Click(object sender, EventArgs e)
        {
            // If either address has not been specified then this is not valid
            if ((startIPAddress.Text == "") || (endIPAddress.Text == ""))
            {
                MessageBox.Show("You must specify both a start and end IP address", "Range Error");
                startIPAddress.Focus();
                DialogResult = DialogResult.None;
            }

            else if (IPAddressComparer.IsGreater(startIPAddress.Text, endIPAddress.Text))
            {
                MessageBox.Show("The starting IP Address must be less than the ending address", "Range Error");
                startIPAddress.Focus();
                DialogResult = DialogResult.None;
            }

            else
            {
                // OK save the values
                _lower = startIPAddress.Text;
                _upper = endIPAddress.Text;
            }
        }