473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Wrapping text in DataGridTextBoxColumn

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

Nov 16 '05 #1
1 8670
The TextBox itself is only used when a cell in the column is being edited.
For displaying data, the PaintText method of the DataGridTextBoxColumn is
used. Therefore, the first thing to try is to start editing some cell and to
ensure the hosted TextBox instance is indeed multi-line. Then, override the
PaintText method (or the Paint method if the former is not virtual) and
provide your own drawing code which will allow for line wraps.

"Sangeetha" <an*******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
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.


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DraguVaso | last post by:
Hi, I need to know the Lenght of the Text in a DataGridTextBoxColumn when I move with the mouse over it, and show it in a ToolTip. I have something that works, but it works only when the...
3
by: Randy | last post by:
Hello, How would this be done? I've looked at the datagrid itself and also the tableStyle and can't find out how to make text wrap in a cell. Thanks
1
by: Jaco Karsten | last post by:
I am writing a customized DataGrid control which will allow the user to only select an entire row (and not a cell inside the row). So I want to add readonly columns to the datagrid. To achieve...
3
by: PawelR | last post by:
Hi, I use dataGrid to show data from DataBase. In one table I've text field (varchar 2048) and data in this field is very long (more characters). How show this text in datagrid as multiline or...
1
by: neil rowe | last post by:
Hi all How do I trap the click event of a standard datagrid text box column on a windows form ? Regards Neil
2
by: Mr.D | last post by:
I know that it is possible to do this: MsgBox(DataGrid1.Item(rowIndex, columnIndex)) However my data has several columns wich I dont controll. Ex: Name, Adress, Favorite Food in different orders....
9
by: Siv | last post by:
Hi, I am trying to find a wrapping routine for text and not having much luck. The reason I need one is that I am producing a report where the text that was stored in the database was written into...
6
by: Markus Ernst | last post by:
Hi Searching for a possibility to display some text with preserved white space and line breaks, but with long lines being wrapped, I found this CSS declaration, which I found helpful: pre {...
6
by: Greg Esres | last post by:
I have some text lines to print that are much longer than the width of the paper, maybe as much as 6 times. For a given page, I'd like everything that doesn't fit to print on a second page, and...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.