I want to read the rows from 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.