Hye. I have a datagrid which retrieves values from database. The datagrid contains only 1 column. Since some of the values in cells are long, we can only see half of the value. So, I enabled both of the scroll bars; the horizontal and vertical. But I can only use the vertical scroll bar while the horizontal scroll bar is unusable. Its color shows like it was disabled. Can anyone tell me how can I make it usable?
I place this code to enable both scroll bars:
dbgUserDefDocs.ScrollBars = dbgBoth
By the way, both scroll bars are automatically generated. I mean, I didn't put Hscrollbar or VScrollbar objects on the datagrid.
Last edited by fajarjalal; August 12th, 2011 at 02:10 AM.
Reason: Grammatical Mistake
Actually as far as I remember you don't even have to add the scroll bars by default they automatically appear as needed. If column(s) are wider than display port then the Horizontal one appears and if taller the vertical one appears.
The column would have to be wider than the view port though. I honestly have never tried it with just one column. Never saw a use for a grid with only one column so may something could be different.
Edit: I did a quick test and with a single column it does not allow to scroll across with the scroll bar. With more than one column it does. Why use a datagrid for a sinlge column of data? Seems like a list box or list view would be a better choice. If you must use a grid then you may want to try the flexgrid control or pull another field into the grid row number or something.
Last edited by DataMiser; August 14th, 2011 at 10:29 PM.