I am doing Windows project, in which I have two DateTimePicker controls, one for StartDate and other for EndDate.
In runtime, when user selects the StartDate and EndDate
Try and deal with DateTime datatypes here rather than converting everything to string. After reading the line from the file, parse out the date. Assuming it is always going to be the first element in the file, and is followed by a space, you could do this by using DateTime lineDate = DateTime.Parse(line.Split(" ")[0]);
Once you have the date from the file in that format, and you have DateTime fromDate
and DateTime toDate
obtained from your date pickers, you can write if(lineDate >= fromDate && lineDate <= toDate) sb.AppendLine(line);