CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2000
    Location
    NY, USA
    Posts
    632

    Smile Scroll Bar in DataGrid

    I'm adding columns to the DataGrid at run time this way:

    Dim ts As DataGridTableStyle
    Dim clnText As DataGridTextBoxColumn

    DataGrid1.DataSource = dsDataSet
    dgEmployees.DataMember = "Employees"
    ts = New DataGridTableStyle()
    ts.MappingName = "Employees"
    clnText = New DataGridTextBoxColumn()
    clnText.MappingName = "EmployeeID"
    clnText.Width = 0
    ts.GridColumnStyles.Add(clnText)

    I'm adding many columns, they appear in the grid. The total width of all columns together is greater than the width of Grid, so horizontal Scroll Bar is added to the grid. Fine. The problem: when I click on the right button on the scroll bar the thumb and contents of the grid do not move. If I move the thumb at least just a little bit to the right by dragging with mouse then the right button works until the thumb is not on the most left position. It
    looks like a bug. Does anybody know any trick to make the right button on the scrollbar work?
    Thank you

    Vlad

  2. #2
    Join Date
    Aug 2000
    Location
    NY, USA
    Posts
    632

    Talking Solved

    I'm using this trick:
    I'm adding all columns I need to be invisible at the end and set their width =1, not 0. Scroll bar works fine and columns almost invisible.
    Vlad

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured