Link to home
Start Free TrialLog in
Avatar of heboh
heboh

asked on

Displaying Multiple Lines on a Winforms DataGrid

Does anyone know how to display data in multiple lines on a datagrid. (Winforms)

Thanks
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

Actually the DataGrid automatically shows multiline data, separated by \n. What you need to do is only adjust the height of the row so that you can see the whole text. Just for a test, enter programmically a value like "line1\nline2" in a cell in the data grid and resize the row to see both lines.

If you need to edit multiline values, then you have to use a custom table style and column styles and use the property DataGridTextBoxColumn.TextBox.Multiline property to set the text box, which edits the data, to accept multiline.
Avatar of heboh
heboh

ASKER

hi.

what i mean is, when the data length exceeds the width of the column, it automatically displays it to the next line (in display mode not in edit mode).

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of heboh

ASKER

thanks a lot TheAvenger. you have been helping me a lot..