public FormAddIPEntry(iphelper.MIB_IPNETROW mib_i)
        {
            this.common_constructor();
            this.b_create        = false;
            this.textBox_IP.Text = new System.Net.IPAddress(mib_i.dwAddr).ToString();
            string str_mac_addr = easy_socket.hexa_convert.byte_to_hexa(mib_i.bPhysAddr);

            if (str_mac_addr.Length > mib_i.dwPhysAddrLen * 3)
            {
                str_mac_addr = str_mac_addr.Substring(0, (int)(mib_i.dwPhysAddrLen * 3 - 1));//*3 for to ascii chars and separator, -1 to remove last separator
            }
            this.textBox_MAC.Text             = str_mac_addr;
            this.textBox_adaptater_index.Text = mib_i.dwIndex.ToString();
            switch (mib_i.dwType)
            {
            case iphelper.CMIB_IPNETROW.dwType_Dynamic:
                this.comboBox_entry_type.Text = "Dynamic";
                break;

            case iphelper.CMIB_IPNETROW.dwType_Invalid:
                this.comboBox_entry_type.Text = "Invalid";
                break;

            case iphelper.CMIB_IPNETROW.dwType_Other:
                this.comboBox_entry_type.Text = "Other";
                break;

            case iphelper.CMIB_IPNETROW.dwType_Static:
                this.comboBox_entry_type.Text = "Static";
                break;

            default:
                this.comboBox_entry_type.Text = "Dynamic";
                break;
            }
        }
        private void button_ok_Click(object sender, System.EventArgs e)
        {
            iphelper.MIB_IPNETROW mib_i = new iphelper.MIB_IPNETROW();


            // get bPhysAddr
            string mac_addr = this.textBox_MAC.Text;

            mac_addr = mac_addr.Replace(" ", "");
            mac_addr = mac_addr.Replace("-", "");
            mac_addr = mac_addr.Replace(".", "");
            mac_addr = mac_addr.Replace(":", "");
            if ((mac_addr.Length % 2 != 0) || (mac_addr.Length / 2 > iphelper.CMIB_IPNETROW.MAXLEN_PHYSADDR))
            {
                MessageBox.Show(this, "Error in Mac address", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            mib_i.bPhysAddr = new byte[iphelper.CMIB_IPNETROW.MAXLEN_PHYSADDR];
            for (int cpt = 0; cpt < mac_addr.Length / 2; cpt++)
            {
                mib_i.bPhysAddr[cpt] = byte.Parse(mac_addr.Substring(2 * cpt, 2),
                                                  System.Globalization.NumberStyles.HexNumber);
            }
            // get dwPhysAddrLen
            mib_i.dwPhysAddrLen = (UInt32)(mac_addr.Length / 2);

            // get dwIndex
            mib_i.dwIndex = System.Convert.ToUInt32(this.textBox_adaptater_index.Text, 10);
            // get dwAddr
            try
            {
                mib_i.dwAddr = System.BitConverter.ToUInt32(System.Net.IPAddress.Parse(this.textBox_IP.Text.Trim()).GetAddressBytes(), 0);
            }
            catch
            {
                MessageBox.Show(this, "Error in IP address", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            // get dwtype
            switch (this.comboBox_entry_type.Text)
            {
            case "Dynamic":
                mib_i.dwType = iphelper.CMIB_IPNETROW.dwType_Dynamic;
                break;

            case "Invalid":
                mib_i.dwType = iphelper.CMIB_IPNETROW.dwType_Invalid;
                break;

            case "Other":
                mib_i.dwType = iphelper.CMIB_IPNETROW.dwType_Other;
                break;

            case "Static":
                mib_i.dwType = iphelper.CMIB_IPNETROW.dwType_Static;
                break;

            default:
                mib_i.dwType = iphelper.CMIB_IPNETROW.dwType_Dynamic;
                break;
            }
            string str_msg;
            UInt32 error_code;

            if (this.b_create)
            {
                error_code = iphelper.iphelper.CreateIpNetEntry(ref mib_i);
                str_msg    = "Entry successfully added";
            }
            else
            {
                error_code = iphelper.iphelper.SetIpNetEntry(ref mib_i);
                str_msg    = "Entry successfully modified";
            }
            if (error_code != 0)
            {
                str_msg = Tools.API.API_error.GetAPIErrorMessageDescription(error_code);
                System.Windows.Forms.MessageBox.Show(this, str_msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.Hide();
            System.Windows.Forms.MessageBox.Show(this, str_msg, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }