The datatable for datagridview1.datasource is usaly some sort of list of objects. (i dont know what kind of list you use but the all all work more or less the same.) in iLogic i created a list of person objects and used that to show how to create a table with it.
[iLogic]
Public Class test
Public Sub Main()
'creat a list
Dim personList As List(Of Person) = New List(Of Person)()
personList.Add(New Person("Jhon", "Do", "20"))
personList.Add(New Person("Albert", "Heijn", "26"))
personList.Add(New Person("Mariska", "Smith", "18"))
'get the sheet
Dim ThisApplication As Application = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Dim doc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = doc.ActiveSheet
'add table to sheet
Dim insertPoint = ThisApplication.TransientGeometry.CreatePoint2d(10, 10)
Dim tableTitle As String = "Persons table"
Dim headerTitles() As String = {"name", "last name", "age"}
Dim table As CustomTable = oSheet.CustomTables.Add(tableTitle, insertPoint, headerTitles.Count, personList.Count, headerTitles)
'fill the table
For index = 1 To table.Rows.Count
Dim row As Row = table.Rows.Item(index)
Dim person As Person = personList(index - 1)
row.Item(1).Value = person.Name
row.Item(2).Value = person.lastname
row.Item(3).Value = person.age
Next
End Sub
End Class
Public Class Person
Public Sub New(name, lastname, age)
Me.Name = name
Me.lastname = lastname
Me.age = age
End Sub
Public Property name As String
Public Property lastname As String
Public Property age As String
End Class
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com