Each property grid item can display multiple lines of text. To enable multi-line support, set the MultiLinesCount property of the item to a number greater than 1. The item will then display the number of lines of text up to the value stored in MultiLinesCount.
VariableItemsHeight must also be True to see multi-line text values in the property grid.
To specify that only one line of text can be displayed (default), set MultiLinesCount to 1.
Start by adding a category to the property grid.
Dim Category As PropertyGridItem Dim Item As PropertyGridItem 'Add a category to the property grid Set Category = wndPropertyGrid.AddCategory("Temp Category")
Now enable multi-line items by setting VariableItemsHeight to True.
'set to True to allow multi-line items in the property grid wndPropertyGrid.VariableItemsHeight = True
Then add a PropertyItemString item with the multi-line text. Text will wrap if too long to display in the item. You can use line breaks and carriage returns to specify exactly where the line will break.
'Add an item to the property grid with a long text value Set Item = Category.AddChildItem(PropertyItemString, "Multi-Line", _ "This is a really long string of text to be displayed in the property grid.")
If you will allow your users to edit the multi-line item then you need to specify how the item will be formatted when the item is in edit mode. The EditStyle property specifies how the item behaves when the item is in edit mode.
'This specifies how the data will be displayed when in edit mode. 'This will keep the text formatted as multi-line when in edit mode. Item.EditStyle = EditStyleMultiLine
Finally you must set how many lines the item will be. The item will always be the number of lines in MultiLinesCount regardless of how many lines of text there are.
'sets the height of the property grid item to 5 lines. Item.MultiLinesCount = 5