-2
I want to read the lines of a file and then add them to a Listbox.
public void subroutine()
{
string linha;
try
{
using (StreamReader read = new StreamReader(Application.StartupPath + "workers.txt", true));
{
do
{
line = read.ReadLine;
listBox1.Items.Add(line);
}
while ((line = read.ReadLine()) != null);
}
}
catch (FileNotFoundException)
{
StreamWriter file = new StreamWriter(Application.StartupPath + "workers.txt", true);
}
}
Error: "Read" does not exist in the current context.
I do not know if it is duplicate, but the question is not clear. Gave error where?
– Maniero