Wrapping text in DataGridTextBoxColumn

G

Guest

I have a datagrid column which I want to expand when i type in some text. Initially I tried increasing the column width on the key down event of that DataGridTextBoxColumn, but it didn't work out as expected. Now, I am trying to increase the height of the row to make it as a multiline column.

private DataGridTextBoxColumn dgcComments
dgcComments = new DataGridTextBoxColumn()
dgcComments.TextBox.Multiline = true
dgcComments.TextBox.AcceptsReturn = true
dgcComments.TextBox.WordWrap = true

I am able to increase the row height, but the text is not wrapping to fit the row height. The text keeps scrolling to the left in a single line. I have set the WordWrap property to True and Multiline property to True, but it doesn't seem to work. Another thing that I tried is to display a vertical scroll bar, but that also fails to meet the reqmt. Anybody has any idea how to wrap text in a text box column of datagrid
Sangeetha.
 
A

Andrew Bingham

Just to say that I have done the same and it works OK in my grid - so the
wordwrap can be made to work !

There may be somnethign about the way you are creating and adding the
ColumnStyles, or the TableStyle, to the grid

Can you post a bit more code showing how "dgc" is added to the DataGrid
TableStyle


--
****************************************************************************
andrewbingham.com

tel 01223 514674 (Cambridge)
mobile 07970 161057
fax 07970 601283
email (e-mail address removed)

DISCLAIMER, PLEASE NOTE:
This communication is for the attention of the named recipient only
The content should not be passed on to any other person.
It is sent in good faith, in confidence, and without legal responsibility.

VIRUS CHECK
Emails and attachments are virus checked using Norton® AntiVirus®
2002 which is regularly updated. However it remains the recipients
responsibility to check emails and attachments sent, or forwarded,
from andrewbingham.com for viruses and macro viruses
****************************************************************************
Sangeetha said:
I have a datagrid column which I want to expand when i type in some text.
Initially I tried increasing the column width on the key down event of that
DataGridTextBoxColumn, but it didn't work out as expected. Now, I am trying
to increase the height of the row to make it as a multiline column.
private DataGridTextBoxColumn dgcComments;
dgcComments = new DataGridTextBoxColumn();
dgcComments.TextBox.Multiline = true;
dgcComments.TextBox.AcceptsReturn = true;
dgcComments.TextBox.WordWrap = true;

I am able to increase the row height, but the text is not wrapping to fit
the row height. The text keeps scrolling to the left in a single line. I
have set the WordWrap property to True and Multiline property to True, but
it doesn't seem to work. Another thing that I tried is to display a vertical
scroll bar, but that also fails to meet the reqmt. Anybody has any idea how
to wrap text in a text box column of datagrid ?
 

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

Top