Hows it going everyone. Right now I am trying to read data from a text file into a datatable, and display the datatable in a new form. I am trying to use a string array to store the variables before adding them to the table. Everything compiles etc correctly, but when the new form with the datagrid that the table is bound to opens, there is nothing in the table.
Private Sub excludebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles excludebtn.Click Dim openFileDialog1 As New OpenFileDialog() openFileDialog1.Filter = "Text File|*.txt|Excel Spreadsheet|*.xls" openFileDialog1.Title = "Open File..." Dim line() As String Dim J As Integer = 0 Dim K As Integer = 0 If openFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim myStream As System.IO.StreamReader = New System.IO.StreamReader(openFileDialog1.FileName) line = myStream.ReadToEnd.Split("\S+") myStream.Close() Do While J < line.Count() Dim lStringReader As New System.IO.StringReader(line(J)) TestdbDataSet.ExcludeTable.Rows.Add(lStringReader) J = J + 1 Loop TestdbDataSet.ExcludeTable.AcceptChanges() Dim ex As exclude ex = New exclude ex.ShowDialog() ex.ExcludeTableDataGridView.PerformLayout() End If End Sub