myGridTable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • guy

    #1

    myGridTable


    if you have to do it try this . (sorry about the wrapping)

    Imports System.Reflecti on
    Imports System
    Imports System.Windows. Forms
    Public Class GridColumnForma tter

    Public Shared Sub SetColumnWidth( ByVal Grid As
    System.Windows. Forms.DataGrid, ByVal ColumnIndex As
    Integer, ByVal ColumnWidth As Integer)
    Dim thing As Object
    Dim Field As FieldInfo = Grid.GetType.Ge tField
    ("myGridTabl e", BindingFlags.In stance Or
    BindingFlags.No nPublic)
    thing = Field.GetValue( Grid)
    Field = thing.GetType.G etField("gridCo lumns",
    BindingFlags.In stance Or BindingFlags.No nPublic)
    thing = Field.GetValue( thing)
    Dim col As
    System.Windows. Forms.DataGridT extBoxColumn = thing
    (ColumnIndex)
    col.Width = ColumnWidth
    End Sub

    End Class

    [color=blue]
    >-----Original Message-----
    >using quickwatch on a winforms datagrid I can see
    >myGridTable property, tunneling down there is much info
    >useful to a developer. why is this not exposed as a[/color]
    public[color=blue]
    >or protected property? Is it to force people to use the
    >TableStyles collection?
    >
    >I suppose I will have to resort to Reflection...
    >
    >guy
    >.
    >[/color]
Working...