Download presentation
Presentation is loading. Please wait.
1
Code for WPF
2
void OnClick2(object sender, RoutedEventArgs e) {
B_Open.Background = Brushes.Pink; Userdata_DG1.ItemsSource=GetData(); // Gets ALL the data } // end onclick handler
3
public List<csvrow> GetData() { string line; // Read a file and display it line by line. csvlist = new List<csvrow>(); // create the list of rows System.IO.StreamReader myFile = new System.IO.StreamReader ("C:\\temp\\oscourse\\ListFile_in.txt"); while ((line = myFile.ReadLine()) != null) process_line(line); // move line into data array (the csvlist) }
4
private void process_line(String x) { int q2pos; string thename; String[] ints; q2pos = …. // skip the initial quote sign thename = x.Substring(1, q2pos); ints = x.Substring(q2pos+3).Split(','); csvlist.Add(new csvrow() { name = thename, int1 = ints[0], int2 = ints[1], int3=ints[2] }); MessageBox.Show("name="+csvlist[0].name); // prove we got the name }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.