This is very easy. Look at my solution. Here I am trying to read a text file with countries listed and then add each line to the CheckedListBox.
You cannot use
The correct way is ,
with proper parameters.
Check my code below.
private void button1_Click(object sender, EventArgs e)
int counter = 0;
System.IO.StreamReader file = new System.IO.StreamReader(@"C:\Users\srikaran\Desktop\Countries.txt");
while ((line = file.ReadLine()) != null)
By default the items are not checked.
Try this code and let me know if you have any issues getting this output.