📅  最后修改于: 2022-03-11 14:49:16.360000             🧑  作者: Mango
private void Form1_Load(object sender, EventArgs e)
{
string line = "";
System.IO.StreamReader file = new System.IO.StreamReader(@"FilePathWithNameAndExtension");
while (!file.EndOfStream)
{
line += file.ReadLine() + "&"; //adding distinct value so that we can split them as a line.
}
string[] newLines = line.Split('&'); //storing lines in array.
txtUserName.Text = newLines[1].Split(':')[1].ToString(); //newLines[1] represent to UserName that means we will extract from second line which is storing the username.
txtCountry.Text = newLines[2].Split(':')[1].ToString();
txtMemberShip.Text = newLines[3].Split(':')[1].ToString();
}