DMottorn

I'm working on an application in WM5 using a form with a data grid. I have code that matches several examples I found and it compiles and executes ok. The problem is there are no columns, column headers or data visible when the form appears. Just an empty form. Here's my code:

DataGrid1.Location = New Point(1, 29)

DataGrid1.ColumnHeadersVisible = True

DataGrid1.Height = 205

DataGrid1.Width = 238

Dim dgd As DataGridTableStyle = New DataGridTableStyle

dgd.GridColumnStyles.Clear()

Application.DoEvents()

MakeDataSet()

mydatatable = mydataset.Tables("Materials")

DataGrid1.DataSource = mydatatable

dgd.MappingName = "Container"

Dim dgdcol1 As DataGridColumnStyle = New DataGridTextBoxColumn

dgdcol1.MappingName = "MaterialsCol"

dgdcol1.Width = 155

dgdcol1.HeaderText = "Materials"

dgd.GridColumnStyles.Add(dgdcol1)

Dim dgdcol2 As DataGridColumnStyle = New DataGridTextBoxColumn

dgdcol2.MappingName = "AmountCol"

dgdcol2.Width = 75

dgdcol2.HeaderText = "Amount"

dgd.GridColumnStyles.Add(dgdcol2)

DataGrid1.TableStyles.Add(dgd)

DataGrid1.Visible = True



Re: Smart Devices VB and C# Projects No Details in DataGrid

DMottorn

Disregard my post. I found that problem.





Re: Smart Devices VB and C# Projects No Details in DataGrid

Ilya Tumanov

Common mistake is to use incorrect mapping names. I would suggest you grab actual table and column names instead of using hard coded strings. Also make sure your data source actually has columns and table indeed exists (because I suspect you¡¯re getting null) and set DataSource after styles.