B
Brett Wesoloski
New to Visual Studio 2005 and am trying to bind a datatable to a
datagridview but not having much luck. I have searched on the internet but
also have not had much luck with that.
This is what I have
Dim dtbData As DataTable = New DataTable("Data")
dtbData.Columns.Add("StackLocation", GetType(String))
dtbData.Columns.Add("SSCC", GetType(String))
Dim drData As DataRow = dtbData.NewRow
drData.Item(1) = "TEST Stack"
drData("SSCC") = "Test SSCC"
dtbData.Rows.Add(drData)
Me.dgData.DataSource = dtbData.DefaultView
When I run this the row will be added to the datagridview but there will not
be any text in the columns.
Now with VS 2003 I would do a databind to the grid but that wasn't the
datagridview.
Brett
datagridview but not having much luck. I have searched on the internet but
also have not had much luck with that.
This is what I have
Dim dtbData As DataTable = New DataTable("Data")
dtbData.Columns.Add("StackLocation", GetType(String))
dtbData.Columns.Add("SSCC", GetType(String))
Dim drData As DataRow = dtbData.NewRow
drData.Item(1) = "TEST Stack"
drData("SSCC") = "Test SSCC"
dtbData.Rows.Add(drData)
Me.dgData.DataSource = dtbData.DefaultView
When I run this the row will be added to the datagridview but there will not
be any text in the columns.
Now with VS 2003 I would do a databind to the grid but that wasn't the
datagridview.
Brett