DataGrid row height

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I've looked at a couple of posts about this and Alex's DataGrid Demo, but I
still don't see how to change row height programatically so that long text
will wrap to the next line in a DataGrid. Has anyone been able to do this?
(preferrably in VB)
 
Thanks. I used the C# -> VB converter online to convert SetGridRowHeight
to:

Public Sub SetGridRowHeight(dg As DataGrid, nRow As Integer, cy As Integer)
Dim arrRows As ArrayList = CType(dg.GetType().GetField("m_rlrow",
BindingFlags.NonPublic Or BindingFlags.Static Or
BindingFlags.Instance).GetValue(dg), ArrayList)
Dim row As Object = arrRows(nRow)
row.GetType().GetField("m_cy", BindingFlags.NonPublic Or
BindingFlags.Static Or BindingFlags.Instance).SetValue(row, cy)
End Sub 'SetGridRowHeight

but GetValue(dg) is returning Nothing.

Has anyone gotten this to work in VB?
 
Perhaps you are trying to invoke this function before you have populated the
grid.
Otherwise you shoud use the SetDefaultGridRowHeight function instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top