DatagridTextBoxColumn WORDWRAP

Hi everyone. I have a datagrid working just fine. I added a tablestyle to it and now I want to make my textboxcolumns to use wordwrap. I added the next lines to my columns

mytablestyle.gridcolumnstyles(i).wordwrap=True

but Its not working at all! Ive read some articles and seen some codes extending the datagridtextboxcolumn but non seem to work. Anyone got a working code How can I make it work




Answer this question

DatagridTextBoxColumn WORDWRAP

  • xpach

    You need to make your column style for that. There is an example of a multiline column on the vb-tips website.


  • bagira20572

    Hi Ken.. I did found your site. I got a problem, when you create the class, you inherit a hottracktextboxcolumn, but where can I find this control

  • Speech Pathologist

    Hi Ken... I thanks for the code, it works really great. Just one question, is which part is the rowheight defined This because sometimes all text in columns its smaller then the column width but it still adds some pixels to the height. Where can I changed this

    Thanks

    JP



  • CodePrince

    The hot track column is also on the website.




  • callmekv

    In addition to setting the column's WordWrap, you need to set the column's AutoSizeMode and the DataGridView's AutoSizeRowsMode property.

    Jim Wooley
    http://devauthority.com/blogs/jwooley/default.aspx



  • Aravind Biran

    To answer your question the height is calculated in the paint event. Look at the line of code with dim sDraw as sizef.

    In my first version of this column style I made each row the right height to display the whole string. The problem with that version was everytime the column was sorted or a new row was added to the datagrid the rows would default back to its prefferedrowheight. To overcome this problem I set the preferredrowheight to largest rowheight need. The code then went ahead and set the new preferredrowheight and manually adjusted all the rows to that size.


  • DatagridTextBoxColumn WORDWRAP