Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

For some reason, when I fill my datagrid with data. The scrollbars dont seem to be enabled until I adjust the width of one of the columns manually.

 

How could I do this in code so the scrollbars are available immediatley, straight after datagrid has been filled?

 

Any help would be appreciated.

Posted
Scroll bars don't show until the width or height of the DataGrid goes past the edges of it. If in your case the width/height is past the edges of your DataGrid and the scroll bars still aren't showing, then I'm not really sure what to say.. odd bug. Perhaps you disabled the scroll bars by default on accident? (I believe there's a property in the properties window to do this)
Gamer extraordinaire. Programmer wannabe.
Posted

Hi wyrd,

 

Thanks for your reply.

 

The width/height of my datagrid does go past the edges.

 

Im not sure which property is used to enable scrollbars on a datagrid. The datagrid doesnt seem to have one???

 

It just seems strange that although the scrollbars appear after the data is filled, it wont let me use them until ive adjusted the row height or column width (during runtime).

  • 4 months later...
Posted

DataGrid Scrollbars

 

I did not find a property in the datagrid to control the scrollbars. I would like to disable the horizontal scrollbar altogether. Does anyone know how this can be done?

Posted
Well, I have the datagrid columns at fixed widths so there is no need for the horizontal scrollbar, yet it still appears on the grid and at times it blocks the last row from being seen. If I could turn it off it would fix this problem.
Posted

Then, why don't you try to change the width of the column? I think the reason the horinzontal bar come out is because your column width is wider than your datagrid width.

 

pcPirate

Be you his eunuch, and your mute I'll be:

When my tongue blabs, then let mine eyes not see.

Posted (edited)

Dalmon, try this.

 

This derive from DataGrid.

 

public class MyDataGrid : System.Windows.Forms.DataGrid

{

public DataGrid myNewDataGrid = null;

public MyDataGrid()

{

this.myNewDataGrid = new DataGrid();

this.HorizScrollBar.Size = new Size( 0, 0 );

}

}

 

This actually set the horizontal scrollbar's size to zero but it does the trick. Hope it helps.

 

pcPirate

Edited by pcPirate

Be you his eunuch, and your mute I'll be:

When my tongue blabs, then let mine eyes not see.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...