if you have to do it try this . (sorry about the wrapping)
Imports System.Reflection
Imports System
Imports System.Windows.Forms
Public Class GridColumnFormatter
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.GetField
("myGridTable", BindingFlags.Instance Or
BindingFlags.NonPublic)
thing = Field.GetValue(Grid)
Field = thing.GetType.GetField("gridColumns",
BindingFlags.Instance Or BindingFlags.NonPublic)
thing = Field.GetValue(thing)
Dim col As
System.Windows.Forms.DataGridTextBoxColumn = thing
(ColumnIndex)
col.Width = ColumnWidth
End Sub
End Class
-----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 publicor protected property? Is it to force people to use the
TableStyles collection?
I suppose I will have to resort to Reflection...
guy
.