Dim csvreader As New StreamReader(txtboxcsv.Text, System.Text.Encoding.Default) Dim sline As String = "" Do sline = csvreader.ReadLine If sline Is Nothing Then Exit Do Dim columns() As String = sline.Split(",") Dim row As DataRow = datatable.NewRow Try row("Employee Number") = columns(0) If columns(2) = "IN" Then row("In Date") = columns(1) ElseIf columns(2) = "OUT" Then row("Out Date") = columns(1) End If row("In Location") = "PAM" row("Out Location") = "PAM" Dim d As String d = Convert.ToDateTime(columns(1)).ToString("dd-MMM-yyyy") row("Shift Starttime") = d + " " + "9:00" row("ShiftEndTime") = d + " " + "18:00" row("Attendance Date") = d row("Time Zone") = 150 datatable.Rows.Add(row) Catch ex As Exception MessageBox.Show(ex.Message) End Try Loop csvreader.Close() DataGridView1.DataSource = datatable Me.Text = datatable.Rows.Count & "rows"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)