private void Button_Filter_Click(object sender, RoutedEventArgs e) { string line; TextBox_LOG.Text = ""; using (StreamReader r = File.OpenText("log.txt")) { while ((line = r.ReadLine()) != null) { String substring = line.Substring(9, 15); DateTime dt = Convert.ToDateTime(substring); DateTime dtod = Convert.ToDateTime(DatumOd.Text); DateTime dtdo = Convert.ToDateTime(DatumDo.Text); if (dt >= dtod && dt <= dtdo) { TextBox_LOG.Text = TextBox_LOG.Text + line + "\n"; } } } TextBox_LOG.Select(TextBox_LOG.Text.Length, 0); }
// Ucitaj Log public void UcitajLog() { string line; TextBox_LOG.Text = ""; using (StreamReader r = File.OpenText("log.txt")) { while ((line = r.ReadLine()) != null) { TextBox_LOG.Text = line + "\n" + TextBox_LOG.Text; } } TextBox_LOG.Select(TextBox_LOG.Text.Length, 0); }