我有几行文本的文本文件。在每一行中有三个必要的信息:用户名,日期和时间。
我通过ListBox
将线条添加到StreamReader
控件中,并且在该控件上方有一个TextBox
控件。我想把用户名放在TextBox
,但我不知道如何。
这是代码:
namespace Zeiterfassung
{
public partial class Uebersicht : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string sPath = @"C:\VSTO\Projects\Zeiterfassung\Zeiterfassung\obj\Debug\Kommt.txt";
using (StreamReader sr = new StreamReader(sPath))
{
while(!sr.EndOfStream)
{
lb_Kommt.Items.Add(sr.ReadLine());
}
}
}
}
}
并且txt文件中的行都与此类似:
User: KIV\vischer, Datum: 10.09.2018, Zeit: 10:49
我需要把“KIV \ Vischer”放在TestBox
,而不是ListBox
。