Is there an easy way to read the contents of a CSV file/XML Sitemap (will just be a bunch of URLS) into a Datagrid view in a win form?
Thankyou
How about using FileHelpers. This can read delimited or fixed length files which you map to a type.
In your case the type will contain a string Url.
Put these into a collection and databind to that.
Something like:
[DelimitedRecord(",")]
public class Row
{
public string Url;
}
and then to read into memory:
FileHelperEngine<Row> engine = new FileHelperEngine<Row>();
engine.ReadFile("input.csv");
There is quite a good article for doing this located here: http://www.codeproject.com/Articles/16951/Populating-data-from-a-CSV-file-to-a-DataGridView the code is in VB.NET but it should be easy to convert either using your own knowledge or using an online conversion tool such as www.developerfusion.com/tools/convert/vb-to-csharp/
read the csv file to a dataset, and then set the dataset as the datasource of the dataGridView . Follow this link for populating the dataset: http://www.java2s.com/Code/CSharp/Database-ADO.net/ReadcommaseparatedvalueintoDataSet.htm
CSV files are common data sources accessible from OLEDb data provider. Fill a DataTable with them and then set the DataTable as DataSource for the GridView.
See here.