|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamic DataGridView missing horizontal scrollbarHi,
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 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 > Vijay wrote:
Show quoteHide quote > Try selecting the last cell of the grid row... using code... that might help Doesn't work -- I used datagridview.currentrow.cells(INDEX).selected => > 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 > > true but no dice. Any other ideas? Thanks 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 > 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 > > 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 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 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 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 > Cor Ligthert [MVP] wrote:
> Crazy Cat, It should be, even when the application is maximized I can only see> > Because that I see "Dock Fill" are you sure that your DataGridView is narrow > enough to show the horizontal scrollbar? > 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 > > did you solve it? I have the same problem
thankss!
http://www.hhdirecto.net
--- Posted via DotNetSlackers.com
Suggestions to reduce memory use when splitting a string
How do you use an unbound DataAdapter? Easy One: Bind a Text Box to a an Integer Variable Dummy question Getting DataGrid row X, Y position and Changing Column Width (2003) Can't get rid of references Reflection Question and MDI question Using PLink interactively as a Telnet process with VB.Net 2003 Generate a text/binary file during installation What/How do I access installed Drivers in .NET 2.0 ? |
|||||||||||||||||||||||