Home Forums WinForms controls Xceed Grid for WinForms Empty grid after databinding.. Reply To: Empty grid after databinding..

Xceed Support
Member
Post count: 5658

I tried pretty much the same code as you and it worked fine.

<code>
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With GridControl1
.BeginInit()
.DataSource = GetTable()
.EndInit()
End With

End Sub

Private Function GetTable() As DataTable
‘Create a DataTable
Dim dt As New DataTable()
Dim dcId As New DataColumn()
dcId.ColumnName = “ComplexId”
dcId.DataType = System.Type.[GetType](“System.Int64”)
dt.Columns.Add(dcId)

Dim dcName As New DataColumn()
dcName.ColumnName = “ComplexName”
dcName.DataType = System.Type.[GetType](“System.String”)
dt.Columns.Add(dcName)
For i As Integer = 0 To 49

Dim row As System.Data.DataRow = dt.NewRow()
row(“ComplexId”) = i
row(“ComplexName”) = i.ToString() + “%”
dt.Rows.Add(row)
Next

Return dt
End Function
</code>

Imported from legacy forums. Posted by CharlesB (had 184 views)