private void btnAddMutli_Click(object sender, EventArgs e) { using (var dialog = new GroupDialogMultiAdd()) { if (dialog.ShowDialog() != DialogResult.OK) { return; } var name = dialog.GroupName; var count = dialog.GroupCount; var added = 1; var skipped = 0; while (added < count + 1) { var groupName = name + (added + skipped); if (tvGroups.Nodes.Find(groupName, false).Length != 0) { skipped++; continue; } CreateGroup(groupName); added++; } } tvGroups.Refresh(); UpdateStats(); }