OK,
I tried this again with the Binding Source and still no scrollbar --
does anyone have any other ideas???? PLEASE???
Here's the code --
Dim tabDetails As TabPage
Dim DetailsBindingSource As BindingSource
Dim dgvDetails As DataGridView
tctlDetails.TabPages.Clear()
If PortDetailsDataSet IsNot Nothing Then
For Each dt As System.Data.DataTable In
PortDetailsDataSet.Tables
Me.tctlDetails.TabPages.Add(dt.Rows(0).Item("MSC_N AME"))
tabDetails =
tctlDetails.TabPages(tctlDetails.TabPages.Count - 1)
dgvDetails = New DataGridView()
With dgvDetails
.Visible = True
.AllowUserToAddRows = False
.AllowUserToDeleteRows = False
DetailsBindingSource = New
BindingSource(PortDetailsDataSet, dt.TableName)
.DataSource = DetailsBindingSource
tabDetails.Controls.Add(dgvDetails)
dgvDetails.Dock = DockStyle.Fill
dgvDetails.ScrollBars =
System.Windows.Forms.ScrollBars.Both
For Each a As DataGridViewColumn In .Columns
a.ReadOnly = True
Next
.ScrollBars = System.Windows.Forms.ScrollBars.Both
End With
Next
End If
BTW, on a side note I allow the user to clear the tabs from the
tabcontrol assuming that because the dynamic bindingsources and
datatables are no longer referenced the VS garbage collecter will clean
them up. Is that a correct assumption or should I delete the referenced
objects myself?
Thanks,
Crazy
Crazy Cat wrote:
I don't have a binding source because I don't use the DataSet designer
to get the tables back. Perhaps that'll help? I'll take a look and post
back.
Thanks,
Cor Ligthert [MVP] wrote: Crazy,
With this code I see a vertical and a horizontal scrollbar
\\\
Dim mydatagridview As New DataGridView
Controls.Add(mydatagridview)
mydatagridview.DataSource = MyEmployeesBindingSource
///
I hope this helps,
Cor