H
Hareth
how do I save and open checked and unchecked items in my listview to a txt
file
this is kinda what I have in mind but doesnt work; I need it for listview w/
checked items and unchecked
private void btnSave_Click(object sender, System.EventArgs e)
{string File;
File = "aaa";
using (StreamWriter sw = new StreamWriter(File))
try
{foreach (string LItem in listBox1.Items)
{ sw.WriteLine(LItem);}
}
finally
{sw.Close();}
}
}
private void btnLoad_Click(object sender, System.EventArgs e)
{string File;
File = "aaa";
try
{
StreamReader sr = new StreamReader(File);
string line;
while((line=sr.ReadLine())!= null )
listBox1.Items.Add(line);
sr.Close();
}
catch (System.Exception)
{}
}
}
file
this is kinda what I have in mind but doesnt work; I need it for listview w/
checked items and unchecked
private void btnSave_Click(object sender, System.EventArgs e)
{string File;
File = "aaa";
using (StreamWriter sw = new StreamWriter(File))
try
{foreach (string LItem in listBox1.Items)
{ sw.WriteLine(LItem);}
}
finally
{sw.Close();}
}
}
private void btnLoad_Click(object sender, System.EventArgs e)
{string File;
File = "aaa";
try
{
StreamReader sr = new StreamReader(File);
string line;
while((line=sr.ReadLine())!= null )
listBox1.Items.Add(line);
sr.Close();
}
catch (System.Exception)
{}
}
}