Help! - DataGridView - scrollbar not visible


J

John Dann

I've got a slightly busy form where a DataGridView control is giving
me problems.

The basic set-up is that the form has a StatusStrip control with Dock
= Bottom. The rest of the form area (other than main menu) is taken up
with a TabControl with Dock = Fill.

The DataGridView is located on one of the tab pages. I want the
StatusStrip to be visible at all times, ie whichever tab page is
currently displayed, and this is indeed what seems to happen.

But the problem is that when the DGV has more columns than will fit
within the tab page, there's no horizontal scroll bar visible. I can't
really see whether it's not there or it is there but hidden beneath
the StatusStrip. (The DGV does have Scrollbars = Both) I've tried
setting the DGV Dock to Fill or Top but it makes no difference.

Have I mis-set some other property of the DGV or is there some other
change that needs to be made to make the combination of controls work
as I want?
 
Ad

Advertisements

L

Lloyd Sheen

John Dann said:
I've got a slightly busy form where a DataGridView control is giving
me problems.

The basic set-up is that the form has a StatusStrip control with Dock
= Bottom. The rest of the form area (other than main menu) is taken up
with a TabControl with Dock = Fill.

The DataGridView is located on one of the tab pages. I want the
StatusStrip to be visible at all times, ie whichever tab page is
currently displayed, and this is indeed what seems to happen.

But the problem is that when the DGV has more columns than will fit
within the tab page, there's no horizontal scroll bar visible. I can't
really see whether it's not there or it is there but hidden beneath
the StatusStrip. (The DGV does have Scrollbars = Both) I've tried
setting the DGV Dock to Fill or Top but it makes no difference.

Have I mis-set some other property of the DGV or is there some other
change that needs to be made to make the combination of controls work
as I want?

You will most likely have to play with the "move to front" in the format
menu for the control. If you place controls on the form and then add one it
will not be in the correct order for form rendering.

Play with moving the DGV to the front or back (I can never remember which)
and that should solve the problem.

LS
 
J

Jack Jackson

I've got a slightly busy form where a DataGridView control is giving
me problems.

The basic set-up is that the form has a StatusStrip control with Dock
= Bottom. The rest of the form area (other than main menu) is taken up
with a TabControl with Dock = Fill.

The DataGridView is located on one of the tab pages. I want the
StatusStrip to be visible at all times, ie whichever tab page is
currently displayed, and this is indeed what seems to happen.

But the problem is that when the DGV has more columns than will fit
within the tab page, there's no horizontal scroll bar visible. I can't
really see whether it's not there or it is there but hidden beneath
the StatusStrip. (The DGV does have Scrollbars = Both) I've tried
setting the DGV Dock to Fill or Top but it makes no difference.

Have I mis-set some other property of the DGV or is there some other
change that needs to be made to make the combination of controls work
as I want?

The problem shouldn't be with the DataGridView, since it apparently is
the only control in the tab page. The problem would be with the
TabControl.

When docking, the Z order (BringToFront and SendToBack) control the
precedence of the controls that are docked. It may be that the
TabControl's bottom is at the bottom of the form, not adjacent to the
StatusStrip's top. Try changing the Z order of the TabControl or the
StatusStrip to get the TabControl's bottom adjoining the StatusStrip.
 
L

Lloyd Sheen

Jack Jackson said:
The problem shouldn't be with the DataGridView, since it apparently is
the only control in the tab page. The problem would be with the
TabControl.

When docking, the Z order (BringToFront and SendToBack) control the
precedence of the controls that are docked. It may be that the
TabControl's bottom is at the bottom of the form, not adjacent to the
StatusStrip's top. Try changing the Z order of the TabControl or the
StatusStrip to get the TabControl's bottom adjoining the StatusStrip.

Ok you have the dreaded TabControl fill problem. I had same problem with
display so to fix it I did the following:

1. Change dock for the DGV in designer to none, since you have only one
control this should not make design a problem
2. In the form load change the dock to fill.

I have no idea what the problem is but this solves the problem. The problem
was logged with Connect and at the time I first saw the problem several
people here confirmed the problem.

Hope this helps

LS
 
J

John Dann

Ok you have the dreaded TabControl fill problem. I had same problem with
display so to fix it I did the following:

1. Change dock for the DGV in designer to none, since you have only one
control this should not make design a problem
2. In the form load change the dock to fill.

I have no idea what the problem is but this solves the problem. The problem
was logged with Connect and at the time I first saw the problem several
people here confirmed the problem.

Hope this helps
Yes indeed - many thanks.

It didn't seem to work at first when I just changed the DGV to Dock =
None in the Designer and reset the dock to Fill in code.

But then I did belt and braces and explicitly set both the Z order and
Dock status of each of the 3 controls concerned (ie StatusStrip,
TabControl and DGV) in code, with Dock for TC and DGV both set to None
in the Designer and all now seems OK. I haven't bothered to unpick
precisely which combination of settings worked the magic but I'm happy
that it is working overall.
 
Ad

Advertisements

Joined
Dec 7, 2008
Messages
1
Reaction score
0
I used to have the same problem.

Cause: All my columns FROZEN property was set to true.
How it happened: I use to have the first 4 columns FOZEN set to true.
I inserted a new column between 1 and 4, then I moved this column at the end of column collection, this cause to have all column FROZEN set to true.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top