views:

156

answers:

1

Hi there,

I have autoscroll enabled BUT I can't have horizontal scrollbars appear. Can anyone please help me to only activate verticle scrollbars on the form with Autoscroll? Thank you :) Any help/suggestions will be much appreciated.

Thanks jase

A: 
Form.HorizontalScroll.Enabled = false;

Should get rid of it.


Interesting, looks like I was right when I said should get rid of it. Searching around it looks like this is a known and unfixed bug in Winforms. This page implies that there may be some way to do it if you don't mind pinvoking some unmanaged code in user32, but it looks like the best bet is simply to ensure that all your controls fit inside the form width (by docking or anchoring them) since the scrollbars are added as required.

Sorry for misleading you.

Martin Harris
Ah, yes I meant Form as in the Form object that you want to remove the scrollbar from ('this' if you are doing it in the form's codebehind file). Glad you got it sorted though.
Martin Harris
it doesn't work at all.
baeltazor
yeah i thought i got it sorted but wasnt paying attention to what iwas doing and i found out that when i have that code on the button-click event it just doesn't work
baeltazor
Thank you very much for your answers Martin. Very much appreciated :-)I'm looking at the link you sent me now and will see how things go. Thanks again. :D
baeltazor