Remove Horizontal Scroll Bars from a datagrid

Hi

I would like to remove the horizontal scroll bar from a datgrid which has a datatable as its datasource (within a windows app - vb.net).  I have 9 columns in total but of these 9, 3 of there widths are set to 0 from within a tablestyle but the datagrid still insists on going to the full width of what it should be.

any help urgently would be greatly appreciated

thanks

matt
caffermAsked:
Who is Participating?
 
prakash_prkConnect With a Mentor Commented:
Try this code

 DataGrid1.Controls(0).Height = 0

regards
prakash
0
 
sungsCommented:
If you used a derived DataGrid, you can access the HorizScrollBar by this.HorizScrollBar and do whatever you want to the bar.
0
 
caffermAuthor Commented:
Thanks

The DataGrid1.Controls(0).Height = 0 worked fine.  

I mustn't be using a dervied grid as i couldn't acess the horix bit.  thanks anyway

matt
0
 
prakash_prkCommented:

Thank you cafferm

regards
Prakash
0
 
lyptusCommented:
Hi,
I'm having the same problem the cafferm was having. prakash_prk solution worked great. However, if the user adjusts the columns to be wider the scroll bars don't show up. Is there any way around this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.