Datagrid Horizontal Scrollbar is Unusable
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Datagrid Horizontal Scrollbar is Unusable

Hybrid View

  1. #1
    Join Date
    Jul 2011
    Posts
    9

    Datagrid Horizontal Scrollbar is Unusable

    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:
    Code:
    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

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Datagrid Horizontal Scrollbar is Unusable

    The horizontal bar will only become enabled when the columns are wider than the viewport of the datagrid...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,823

    Re: Datagrid Horizontal Scrollbar is Unusable

    You will need to increase the width of the column.
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Jul 2011
    Posts
    9

    Re: Datagrid Horizontal Scrollbar is Unusable

    I already tried to enlarge the column width. But the horizontal scroll bar is still unusable.
    I even made the column width larger than the datagrid width, but still the same.

  5. #5
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,823

    Re: Datagrid Horizontal Scrollbar is Unusable

    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.
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Jul 2011
    Posts
    9

    Re: Datagrid Horizontal Scrollbar is Unusable

    oh really? well, I'm handling a simple alteration on an existing system. Since I'm new, so, I also don't know why they use datagrid. Anyway, thanks for your information. =)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center