I want to extract the input data in text box from text file and want to display the result in datagrid.
i am using textbox for userentry, a button for loading the requirement and datagrid to fill the requirement and display ...
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- {
- string var;
- var = tb.Text;
- var queryname = new List();
- using (StreamReader reader = new StreamReader("C:\\Documents\\TestFile.txt"))
- {
- while (true)
- {
- string line = reader.ReadLine();
- if (line == null)
- {
- break;
- }
- queryname.Add(new QueryName(line));
- }
- }
-
- dg.ItemsSource = queryname;
- }