private void cmbPlc_SelectedIndexChanged(object sender, EventArgs e) { if (cmbPlc.SelectedIndex == cmbPlc.Items.Count - 1) { AddPlc addPlc = new AddPlc(); DialogResult dr = addPlc.ShowDialog(); string title = addPlc.ipAddress; if (addPlc.bookmarkName != "") { title = addPlc.bookmarkName + " (" + title + ")"; } cmbPlc.Items.Insert(cmbPlc.Items.Count - 1, title); cmbPlc.SelectedIndex = cmbPlc.Items.Count - 2; wPlcBookmark bp = new wPlcBookmark(cmbPlc.SelectedIndex, addPlc.bookmarkName, addPlc.ipAddress); plcListing.Add(bp); savePlcBookmarks(); } }
private void cmbPlc_SelectedIndexChanged(object sender, EventArgs e) { if (cmbPlc.SelectedIndex == cmbPlc.Items.Count -1) { AddPlc addPlc = new AddPlc(); DialogResult dr = addPlc.ShowDialog(); string title = addPlc.ipAddress; if (addPlc.bookmarkName != "") { title = addPlc.bookmarkName + " (" + title + ")"; } cmbPlc.Items.Insert(cmbPlc.Items.Count - 1, title); cmbPlc.SelectedIndex = cmbPlc.Items.Count - 2; wPlcBookmark bp = new wPlcBookmark(cmbPlc.SelectedIndex, addPlc.bookmarkName, addPlc.ipAddress); plcListing.Add(bp); savePlcBookmarks(); } }