By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 1,990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

Dynamic DataGridView missing horizontal scrollbar

P: n/a
Hi,

I am dynamically creating datagridviews for my application, then
filling them with data from a 30 row datatable, and everything seems to
work great with one exception. My horizontal scrollbar never appears --
no problem with the vertical scrollbar. I even try setting the
scrollbars property to Both, but still I only see the vertical
scrollbar.

Is there any other way to force the DataGridView's vertical scrollbar
to appear?????

Thanks,

Crazy

Apr 3 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Try selecting the last cell of the grid row... using code... that might help

Vijay

"Crazy Cat" <da******@hotmail.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
Hi,

I am dynamically creating datagridviews for my application, then
filling them with data from a 30 row datatable, and everything seems to
work great with one exception. My horizontal scrollbar never appears --
no problem with the vertical scrollbar. I even try setting the
scrollbars property to Both, but still I only see the vertical
scrollbar.

Is there any other way to force the DataGridView's vertical scrollbar
to appear?????

Thanks,

Crazy

Apr 3 '06 #2

P: n/a

Vijay wrote:
Try selecting the last cell of the grid row... using code... that might help

Vijay

"Crazy Cat" <da******@hotmail.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
Hi,

I am dynamically creating datagridviews for my application, then
filling them with data from a 30 row datatable, and everything seems to
work great with one exception. My horizontal scrollbar never appears --
no problem with the vertical scrollbar. I even try setting the
scrollbars property to Both, but still I only see the vertical
scrollbar.

Is there any other way to force the DataGridView's vertical scrollbar
to appear?????

Thanks,

Crazy


Doesn't work -- I used datagridview.currentrow.cells(INDEX).selected =
true but no dice.

Any other ideas?

Thanks

Apr 3 '06 #3

P: n/a
uhm.. ok.., And you do have more than the visible area of columns, still not
getting scrollbars.. are u using 2.0 or 1.1 ?

VJ

"Crazy Cat" <da******@hotmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...

Vijay wrote:
Try selecting the last cell of the grid row... using code... that might
help

Vijay

"Crazy Cat" <da******@hotmail.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
> Hi,
>
> I am dynamically creating datagridviews for my application, then
> filling them with data from a 30 row datatable, and everything seems to
> work great with one exception. My horizontal scrollbar never appears --
> no problem with the vertical scrollbar. I even try setting the
> scrollbars property to Both, but still I only see the vertical
> scrollbar.
>
> Is there any other way to force the DataGridView's vertical scrollbar
> to appear?????
>
> Thanks,
>
> Crazy
>


Doesn't work -- I used datagridview.currentrow.cells(INDEX).selected =
true but no dice.

Any other ideas?

Thanks

Apr 3 '06 #4

P: n/a
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
Apr 4 '06 #5

P: n/a
I'm pretty sure I'm using 2.0. I do have more than the visible area of
columns -- almost twice as much.

Thanks,

Vijay wrote:
uhm.. ok.., And you do have more than the visible area of columns, still not
getting scrollbars.. are u using 2.0 or 1.1 ?

VJ

"Crazy Cat" <da******@hotmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...

Vijay wrote:
Try selecting the last cell of the grid row... using code... that might
help

Vijay

"Crazy Cat" <da******@hotmail.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
> Hi,
>
> I am dynamically creating datagridviews for my application, then
> filling them with data from a 30 row datatable, and everything seems to
> work great with one exception. My horizontal scrollbar never appears --
> no problem with the vertical scrollbar. I even try setting the
> scrollbars property to Both, but still I only see the vertical
> scrollbar.
>
> Is there any other way to force the DataGridView's vertical scrollbar
> to appear?????
>
> Thanks,
>
> Crazy
>


Doesn't work -- I used datagridview.currentrow.cells(INDEX).selected =
true but no dice.

Any other ideas?

Thanks


Apr 4 '06 #6

P: n/a
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


Apr 4 '06 #7

P: n/a
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


Apr 5 '06 #8

P: n/a
Crazy Cat,

Because that I see "Dock Fill" are you sure that your DataGridView is narrow
enough to show the horizontal scrollbar?

Cor

"Crazy Cat" <da******@hotmail.com> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
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

Apr 6 '06 #9

P: n/a

Cor Ligthert [MVP] wrote:
Crazy Cat,

Because that I see "Dock Fill" are you sure that your DataGridView is narrow
enough to show the horizontal scrollbar?

It should be, even when the application is maximized I can only see
about 50 - 60 % of the columns.

Thanks,
Cor

"Crazy Cat" <da******@hotmail.com> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
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


Apr 6 '06 #10

P: n/a
did you solve it? I have the same problem
thankss!


http://www.hhdirecto.net
---
Posted via DotNetSlackers.com
Nov 20 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.