Open file to populate collectionBase?

57 views Asked by At

I'm doing a little project for school and I'm stuck on the fact that they want us to use collectionbase and file handling...

My question is what do I need to do on launch of the app to open the .txt file and populate a collectionbase? Is this possible? Or is there another way to make the app remember the collectionbase?

My code so far:

    System.IO.StreamReader reader = new System.IO.StreamReader("Auth.txt");
    String text = reader.ReadToEnd();
    StringBuilder sb = new StringBuilder(); 
    if (File.ReadAllText("Comptes.txt").Contains(Nm))    
    {
        String[] strLines = File.ReadAllLines("Comptes.txt");
        foreach (String strLine in strLines)
            sb.AppendLine(strLine);   
        label1Welcome.Text = sb.ToString();    
        ////here is where I'm stuck - how to insert info in collectionbase 
    }  
    else
    {
       label1Welcome.Text = "!!";
    }
}
0

There are 0 answers