Even though you have selected an answer, as mentioned by john a better path is to use a BindingList. In the code below a custom BindingList is used to provide a single method to add items to the current data which keeps your code clean. You can use a standard BindingList, for the second load use a foreach to append data.
There are two buttons, first to load from a text file and in turn load the ComboBox for the first time, second button appends to the data. Both use hard coded file names, that you can easily change.
Place the following in a class file in your project.
Source
public class BindingListSpecial<I> : BindingList<I>
{
private readonly List<I> _baseList;
public BindingListSpecial() : this(new List<I>()) { }
public BindingListSpecial(List<I> baseList) : base(baseList)
{
_baseList = baseList ?? throw new ArgumentNullException();
}
public void AddRange(IEnumerable<I> vals)
{
if (vals is ICollection<I> collection)
{
int requiredCapacity = Count + collection.Count;
if (requiredCapacity > _baseList.Capacity)
_baseList.Capacity = requiredCapacity;
}
bool restore = RaiseListChangedEvents;
try
{
RaiseListChangedEvents = false;
foreach (I v in vals)
Add(v); // We cant call _baseList.Add, otherwise Events wont get hooked.
}
finally
{
RaiseListChangedEvents = restore;
if (RaiseListChangedEvents)
ResetBindings();
}
}
}
Form code
public partial class Form1 : Form
{
private BindingListSpecial<string> _bindingList;
public Form1()
{
InitializeComponent();
}
private void LoadButton1_Click(object sender, EventArgs e)
{
_bindingList = new BindingListSpecial<string>(File.ReadAllLines("TextFile1.txt").ToList());
comboBox1.DataSource = _bindingList;
}
private void LoadButton2_Click(object sender, EventArgs e)
{
_bindingList.AddRange(File.ReadAllLines("TextFile2.txt").ToList());
}
}