Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1825
Wingrid - Hiding columns - with wildcard names
posted

I have a grid attached to a table:

[Heading] [Section] [LineCt 2012-11] [RevCt 2012-11] .......

 

What I would like to do is based on what the user chooses, Line Count or Rev Count, hide either the [LineCt 2012-11] or [RevCt 2012-11] columns.

Noting that I do not know how many of them Line/rev columns I have. Only that I will have 1 each for each Yr/Mnth combo.

Something Like: .DisplayLayout.Bands(0).Columns("Rev%").Hidden = True

Would hide all the Rev count columns.

Hope that makes sense.

Thanks

Deasun

Parents
  • 469350
    Offline posted

    Hi Deasun,

    There's no way to index columns with a wildcard like that. What you would have to do is loop through the columns and compare each column's key with the string you want. Something like this:


            For Each column As UltraGridColumn In Me.UltraGrid1.DisplayLayout.Bands(0).Columns
                If (column.Key.StartsWith("Rev")) Then
                    column.Hidden = True
                Else
                    column.Hidden = False
                End If
            Next

Reply Children
No Data