Example #1
0
        private void SetIPInfo()
        {
            if (comboBox_networkAdapter.SelectedIndex >= 0)
            {
                CIPInfo ipInfo = comboBox_networkAdapter.Items[comboBox_networkAdapter.SelectedIndex] as CIPInfo;
                if (ipInfo != null)
                {
                    ipInfo.IPAddress = textBox_ip.Text;

                    ipInfo.SubnetMask = textBox_mask.Text;

                    ipInfo.DefaultGetway = textBox_gateway.Text;
                }
            }
        }
Example #2
0
        private void comboBox_networkAdapter_SelectedIndexChanged(object sender, EventArgs e)
        {
            textBox_ip.Text      = "";
            textBox_mask.Text    = "";
            textBox_gateway.Text = "";

            if (comboBox_networkAdapter.SelectedIndex >= 0)
            {
                CIPInfo ipInfo = comboBox_networkAdapter.Items[comboBox_networkAdapter.SelectedIndex] as CIPInfo;
                if (ipInfo != null)
                {
                    textBox_ip.Text = ipInfo.IPAddress;

                    textBox_mask.Text = ipInfo.SubnetMask;

                    textBox_gateway.Text = ipInfo.DefaultGetway;
                }
            }
        }