Listview not being populated
Posted
by Luke
on Stack Overflow
See other posts from Stack Overflow
or by Luke
Published on 2010-04-19T17:23:32Z
Indexed on
2010/04/19
17:33 UTC
Read the original article
Hit count: 238
c#
I have put some console.writeline code in to test, but they arent appearing in the output box?
public static ArrayList myDeliveries = new ArrayList();
public mainForm()
{
InitializeComponent();
}
private void mainForm_Load(object sender, EventArgs e)
{
if (!File.Exists("../../MealDeliveries.txt"))
{
MessageBox.Show("File not found!");
return;
}
using (StreamReader sr = new StreamReader("../../MealDeliveries.txt"))
{
//first line is delivery name
string strDeliveryName = sr.ReadLine();
Console.WriteLine("some tetttttttttt23423423423423423ttttttttttttttttttttttt");
while (strDeliveryName != null)
{
//other lines
Delivery d = new Delivery(strDeliveryName, sr.ReadLine(),
sr.ReadLine(), sr.ReadLine(),
sr.ReadLine(), sr.ReadLine(),
sr.ReadLine());
mainForm.myDeliveries.Add(d);
//check for further values
strDeliveryName = sr.ReadLine();
}
}
displayDeliveries();
}
private void displayDeliveries()
{
lstDeliveryDetails.Items.Clear();
Console.WriteLine("some tettttttttttttttttttttttttttttttttt");
Console.WriteLine(mainForm.myDeliveries.Count);
foreach (Delivery d in mainForm.myDeliveries)
{
lstDeliveryDetails.Items.Add(d.DeliveryName);
}
}
Can anyone help??
© Stack Overflow or respective owner