May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.
Private Sub BindDataTable() Dim y As Integer, x As Integer Dim MemoryTable As DataTable MemoryTable = New DataTable("GridTable") Dim DataRows(MaxRows) As DataRow Dim DataColumns(MaxColumns) As DataColumn For x = 1 To MaxColumns DataColumns(x - 1) = New DataColumn(CType(x, String)) DataColumns(x - 1).DataType = System.Type.GetType("System.String") MemoryTable.Columns.Add(DataColumns(x - 1)) Next For y = 1 To MaxRows DataRows(y - 1) = MemoryTable.NewRow Next For y = 1 To MaxRows For x = 1 To MaxColumns DataRows(y - 1).Item(CType(x, String)) = "Test Data" Next x Next y 'Bind Dim Dset As New DataSet() Dset = New DataSet() Dset.Tables.Add(MemoryTable) DataGridMain.DataSource = Dset DataGridMain.DataMember = "GridTable" End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.