|
|||||||||||||||||
|
Home > Code Samples > Display CSV file in GridView in VBDisplay a CSV File in a GridView on an ASP.Net pageVB.Net Private Sub _Default_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' declare a new GridView Dim csvGrid As New GridView() ' add GridView to page Form.Controls.Add(csvGrid) ' declare csv parser passing in path to file Using csvData = New CsvReader(Server.MapPath("products.csv")) ' set GridView to use DataTable returned from parser as the source ' for it's data. True is passed in to signify that file contains a ' header row which will name returned DataColumn's based on values ' read in from header row. csvGrid.DataSource = csvData.ReadToEnd(True) End Using ' dispose of parser ' tell GridView to create display based on values from DataSource csvGrid.DataBind() End Sub |
||||||||||||||||
|
|||||||||||||||||