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));
- }
- }
- //var grid = sender as DataGrid;
- dg.ItemsSource = queryname;
- }

Salman BegRank #284 · 8.8K reputationPosted Apr 16, 2020, 11:53 PM EDT
Vinay SinghRank #604 · 4K reputationPosted Apr 17, 2020, 5:11 AM EDT