DatagridView

  • Thread starter Thread starter Arne Garvander
  • Start date Start date
A

Arne Garvander

I have a dataset with one table, which I build from scratch (not using SQL
server).
It displays fine on the web with a datagrid.
I use the same dataset and apply it to a DataGridView in a windowsform. My
datagridview does not display at all. What am I doing wrong?

HistoryGrid.AutoSize = True
HistoryGrid.Parent = Me
HistoryGrid.Dock = DockStyle.Fill
HistoryGrid.AutoGenerateColumns = True
HistoryGrid.DataSource = table
 
If I remove
HistoryGrid.Parent = Me
My original problem goes away.

Try "Me.Controls.Add(HistoryGrid)" instead of "HistoryGrid.Parent =
Me".

The documentation says that setting a control's Parent property to
Nothing removes it from the parent's Controls collection, but doesn't
mention setting Parent. Maybe doing it that way doesn't work.
 
Back
Top