Author Topic: vb.net DataGvriView HorizontalScrollBar Problem [SOLVED]  (Read 5312 times)

0 Members and 1 Guest are viewing this topic.

Ricky_76

  • Guest
vb.net DataGvriView HorizontalScrollBar Problem [SOLVED]
« on: April 13, 2011, 09:09:59 AM »
Hi,

I have a little problem making the horizontal scrollbar of DataGrivView visible.
To be honest the bar appear when populating, but disappear as soon as the control is populated.

The dgv properties are setted correctly (imho):
- ScrollBars : Both
- Dock : Fill

If there is no solution to make it work, I'll need to know how to use an external
ScrollBar to "move" the DataGrivView inside his parent control.


Thanks
/r
« Last Edit: April 20, 2011, 11:11:09 AM by Ricky_76 »

n.yuan

  • Bull Frog
  • Posts: 348
Re: vb.net DataGvriView HorizontalScrollBar Problem
« Reply #1 on: April 14, 2011, 10:59:02 AM »
How do you add columns to the DataGridView? At design time or at run time by code? How do you know the scroll bar is there when the datagridview is being populated?

If the columns are added at design time (with "Add Column" and "Edit Columns" dialog box in VS), when the total width if all columns is greater than the width of the DataGridView, does the scroll bar appear? It should, unless there is one or more columns' "AutoSizeMode" is set to "Fill", which would shrink one or more columns' width so that all columns would fit the DataGridView, thus no scroll bar is needed.

Ricky_76

  • Guest
Re: vb.net DataGvriView HorizontalScrollBar Problem
« Reply #2 on: April 14, 2011, 12:25:27 PM »
Hi yuan,

I add data by assigning a DataTable to the .DataSource property.

I know that the ScrollBar is visible because I see it when populating (1, 2 seconds).

thanks
/r

Ricky_76

  • Guest
Re: vb.net DataGvriView HorizontalScrollBar Problem
« Reply #3 on: April 20, 2011, 11:10:35 AM »
Ok, problem solved.

Was due to the code:

For Each column As DataGridViewColumn In dgv_mTelecamera.Columns
     column.Frozen = True
Next column


tnx
/r