private void newrecord() { Yeni yeni_ip = new Yeni(); yeni_ip.ShowDialog(); if (yeni_ip.DialogResult == DialogResult.OK) { kayit.Add(new kaydim { record_name = yeni_ip.ipsetname_textBox.Text, record_adaptor = yeni_ip.network_adaptor_listBox.GetItemText(yeni_ip.network_adaptor_listBox.SelectedItem), record_ip = yeni_ip.ip_textBox.Text, record_submask = yeni_ip.subnet_textBox.Text, record_gateway = yeni_ip.gateway_textBox.Text, record_DHCP = yeni_ip.auto_checkBox.Checked } ); setting_listbox.Items.Add(yeni_ip.ipsetname_textBox.Text); MessageBox.Show("Successfully saved !", "Info"); } }
private void editselected() { int selected = setting_listbox.SelectedIndex; if (selected < 0) { MessageBox.Show(this, "Please select a settings name in the listbox !", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Yeni yeni_ip = new Yeni(); yeni_ip.ipsetname_textBox.Text = kayit.ElementAt(selected).record_name; yeni_ip.network_adaptor_listBox.SetSelected(yeni_ip.network_adaptor_listBox.FindString(kayit.ElementAt(selected).record_adaptor), true); yeni_ip.ip_textBox.Text = kayit.ElementAt(selected).record_ip; yeni_ip.subnet_textBox.Text = kayit.ElementAt(selected).record_submask; yeni_ip.gateway_textBox.Text = kayit.ElementAt(selected).record_gateway; yeni_ip.auto_checkBox.Checked = kayit.ElementAt(selected).record_DHCP; if (!kayit.ElementAt(selected).record_DHCP) { yeni_ip.DHCP_goster(); } else { yeni_ip.DHCP_gizle(); } yeni_ip.ShowDialog(); if (yeni_ip.DialogResult == DialogResult.OK) { kayit.ElementAt(selected).record_name = yeni_ip.ipsetname_textBox.Text; kayit.ElementAt(selected).record_adaptor = yeni_ip.network_adaptor_listBox.GetItemText(yeni_ip.network_adaptor_listBox.SelectedItem); kayit.ElementAt(selected).record_ip = yeni_ip.ip_textBox.Text; kayit.ElementAt(selected).record_gateway = yeni_ip.gateway_textBox.Text; kayit.ElementAt(selected).record_submask = yeni_ip.subnet_textBox.Text; kayit.ElementAt(selected).record_DHCP = yeni_ip.auto_checkBox.Checked; setting_listbox.Items[selected] = yeni_ip.ipsetname_textBox.Text; } }