« Control.ModifierKeys | Main | Earn your keep »

DataGrid.ColAutoResize

Posted by: David Carroll

ColAutoResize is an undocumented Private member of Datagrid. This is how to call it via Reflection:

Dim gridType As Type = grid.GetType()
Dim mi as MethodInfo = gridType.GetMethod("ColAutoResize", _
BindingFlags.Instance Or BindingFlags.NonPublic)
mi.Invoke(grid, New Object() {0})

Comments

Add New Comment

Cristiano wrote:
Hi! I Try use your method but i cant.
This method found.

Dim t As Type = grid.GetType()
Dim mi As MethodInfo = t.GetMethod("ColAutoResize", BindingFlags.Instance Or BindingFlags.NonPublic)

Dim i As Integer
For i = dgdGrid.FirstVisibleColumn To dgdGrid.VisibleColumnCount - 1
m.Invoke(grid, New Object() {i})
Next