![]() StrBuilder.Append(String.Join(",", headers.ToArray())).Append("\r\n") įoreach (DataGridColumn col in grid.Columns)īinding = (col as DataGridBoundColumn).Binding Public string ExportDataGrid(bool withHeaders, DataGrid grid) Private string FormatCSVField(string data) While ((fields1 = csv.GetCSVLine()) != null) ObservableCollection headers1 = new ObservableCollection() ObservableCollection> datatable1 = new ObservableCollection>() Private ObservableCollection> ReadAppendedCSVData(CSVReader csv) MessageBox.Show("The data needs to be in either Excel or CSV format.", "Error pasting in data.", MessageBoxButton.OK) Please rename the variables prior importing the data into InVivoStat.", "Load DataSet", MessageBoxButton.OK) "Error: Two or more of the variables have the same name. If (firstLine) //the first row will always be treated as column headersįor (int i = 0 i data = theGrid.SelectedItem as Dictionary While ((fields = csv.GetCSVLine()) != null) use the csvreader to read in the csv data ![]() ObservableCollection headers = new ObservableCollection() ObservableCollection> datatable = new ObservableCollection>() Private ObservableCollection> ReadInCSVData(CSVReader csv) Private IEnumerable ConvertToIEnumerable(List> rows)įoreach (var row in rows) yield return row Dictionary data = theGrid.SelectedItems as Dictionary Private void btnRemove_Click(object sender, RoutedEventArgs e) ![]() MessageBox.Show("File aleady pesent on the blotter") MessageBox.Show("No file selected to upload") Using (CSVReader csv = new CSVReader(fs1)) Private void btnLoad_Click(object sender, RoutedEventArgs e) Ofd.Filter = "Excel or CSV Files|*.xls *.xlsx *.csv" Private void btnBrowse_Click(object sender, RoutedEventArgs e) OpenFileDialog ofd = new OpenFileDialog() Public partial class ImportCSV : UserControl THe data is not coming from a database but i am pulling the data from a csv file.So u can use any csv file which takes first row as headers and the rest as its values. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |