CheckedListBox and C#
-
On the.
checkedlistbox
andbutton
I wrote the code when the line was chosen.checkedlistbox
And pressed on the button, but events.button_Click
Do what the programme needs, and now the question?How can we do that when messages are issued
checkedlistbox
If it's not chosen or pressed on the button, it's still on it until we pick and push the button?By the way, the message may not be selected for a few days and that the most important message is recorded.
checkedlistbox
at specified dates (mm,dd,g).We've got to do that so we don't have duplicate lines on file or reading from the file.
checkedlistbox
-
I realized I had to keep the list until the element was chosen.
You need to keep the list in the file. When you start reading it. When you chose the element, it's in the event of the button.
button
either remove this element or remove it.checked
this element.Keep the list in the file.
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { string sPath = "blabla.txt";
System.IO.StreamWriter SaveFile = new System.IO.StreamWriter(sPath,true); foreach (var items in checkedListBox1.Items) { SaveFile.WriteLine(items.ToString()); } SaveFile.Close(); }
We're downloading the file.
private void button1_Click(object sender, EventArgs e)
{
string sPath = "blabla.txt";System.IO.StreamReader ReadFile = new System.IO.StreamReader(sPath); string line; while ((line = ReadFile.ReadLine()) != null) { checkedListBox1.Items.Add(line); } ReadFile.Close(); }