Here is a simple example that should provide a starting point for you.
VB Code:
Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click Dim dt As New DataTable("Customers") dt.Columns.Add("firstname", System.Type.GetType("System.String")) dt.Columns.Add("lastname", System.Type.GetType("System.String")) dt.Columns.Add("department", System.Type.GetType("System.String")) dt.Columns.Add("email", System.Type.GetType("System.String")) dt.Columns.Add("phone", System.Type.GetType("System.String")) Dim oReader As New StreamReader("C:\Customers.txt") Dim oCust As String Dim oData() As String Dim Index As Int32 Dim drItem As DataRow Do oCust = oReader.ReadLine oData = oCust.Split(",".ToCharArray) For Index = oData.GetLowerBound(0) To oData.GetUpperBound(0) drItem = dt.NewRow drItem(Index) = oData(Index).ToString dt.Rows.Add(drItem) drItem = Nothing Next Loop Until oCust Is Nothing End Sub




Reply With Quote