Option Strict On Imports System.Data Imports System.IO Imports System.Text Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click DataGridView1.DataSource = ReadFromDataFile("D:\TEMP\TEST.TXT") End Sub Private Function ReadFromDataFile(dataFile As String) As DataTable Dim tbl As New DataTable("Array") For Each line In File.ReadLines(dataFile, Encoding.GetEncoding("Shift_JIS")) Dim values(-1) As Object Try Dim separate = Split(line, ") = Array(", 2, CompareMethod.Text) Dim body = separate.Last().TrimEnd(" )".ToCharArray()) Dim fields As String() = body.Split(","c) values = fields.Select(AddressOf ToInt).ToArray() For f = tbl.Columns.Count + 1 To values.Length tbl.Columns.Add("Col" & CStr(f), GetType(Integer)) Next Catch Finally tbl.Rows.Add(values) End Try Next Return tbl End Function Private Function ToInt(s As String) As Object Dim i As Integer If Integer.TryParse(s.Replace(""""c, ""), i) Then Return i Else Return DBNull.Value End If End Function End Class