Home All Groups Group Topic Archive Search About

Dynamic DataGridView missing horizontal scrollbar

Author
3 Apr 2006 8:21 PM
Crazy Cat
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

Author
3 Apr 2006 8:59 PM
Vijay
Try selecting the last cell of the grid row... using code... that might help

Vijay

Show quoteHide quote
"Crazy Cat" <danbr***@hotmail.com> wrote in message
news:1144095717.868539.46610@v46g2000cwv.googlegroups.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
>
Author
3 Apr 2006 9:48 PM
Crazy Cat
Vijay wrote:
Show quoteHide quote
> Try selecting the last cell of the grid row... using code... that might help
>
> Vijay
>
> "Crazy Cat" <danbr***@hotmail.com> wrote in message
> news:1144095717.868539.46610@v46g2000cwv.googlegroups.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
Author
3 Apr 2006 10:11 PM
Vijay
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

Show quoteHide quote
"Crazy Cat" <danbr***@hotmail.com> wrote in message
news:1144100910.018851.77170@i40g2000cwc.googlegroups.com...
>
> Vijay wrote:
>> Try selecting the last cell of the grid row... using code... that might
>> help
>>
>> Vijay
>>
>> "Crazy Cat" <danbr***@hotmail.com> wrote in message
>> news:1144095717.868539.46610@v46g2000cwv.googlegroups.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
>
Author
4 Apr 2006 2:22 PM
Crazy Cat
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:
Show quoteHide quote
> 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" <danbr***@hotmail.com> wrote in message
> news:1144100910.018851.77170@i40g2000cwc.googlegroups.com...
> >
> > Vijay wrote:
> >> Try selecting the last cell of the grid row... using code... that might
> >> help
> >>
> >> Vijay
> >>
> >> "Crazy Cat" <danbr***@hotmail.com> wrote in message
> >> news:1144095717.868539.46610@v46g2000cwv.googlegroups.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
> >
Author
4 Apr 2006 7:17 AM
Cor Ligthert [MVP]
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
Author
4 Apr 2006 2:25 PM
Crazy Cat
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:
Show quoteHide quote
> 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
Author
5 Apr 2006 7:34 PM
Crazy Cat
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_NAME"))
                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:
Show quoteHide quote
> 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
Author
6 Apr 2006 6:21 AM
Cor Ligthert [MVP]
Crazy Cat,

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

Cor

Show quoteHide quote
"Crazy Cat" <danbr***@hotmail.com> schreef in bericht
news:1144265673.701410.259600@u72g2000cwu.googlegroups.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_NAME"))
>                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
>
Author
6 Apr 2006 1:53 PM
Crazy Cat
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,

Show quoteHide quote
> Cor
>
> "Crazy Cat" <danbr***@hotmail.com> schreef in bericht
> news:1144265673.701410.259600@u72g2000cwu.googlegroups.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_NAME"))
> >                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
> >
Author
20 Nov 2006 2:59 PM
wakeup
did you solve it? I have the same problem thankss! http://www.hhdirecto.net
---
Posted via DotNetSlackers.com