473,587 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dataGrid word wrap in windows forms.

Would anyone out there tell me how to make my C# datagrid
wrap the text in the cells. I haven't seen a good how to
out there that does this. I know it has something to do
with using styles but haven't got styles to work right yet
with my grid that get's dynamically populated by xml files.
Here's my code that gets the grid.

private void mnuContacts_Cli ck(object sender,
System.EventArg s e)
{
string fn="C:\\applica tionRoot\\data\ \salesdata.xml" ;
DataSet ds=new DataSet();
ds.ReadXml(fn);
lbTables.Items. Clear();
foreach (DataTable dt in ds.Tables)
{
lbTables.Items. Add(dt.TableNam e);
}
dataSet=ds;
lbTables.Select edIndex=0;
fnSchema=fn;
this.Text="Your Company - "+fnSchema;
}
Nov 15 '05 #1
1 3525
I was able to get styles working properly but still don't
know how to get the text to wrap. I've tried setting the
textbox properties to be multiline and do word wrap but no
go.
Any help would be wonderful.
Bernerd
-----Original Message-----
Would anyone out there tell me how to make my C# datagrid
wrap the text in the cells. I haven't seen a good how to
out there that does this. I know it has something to do
with using styles but haven't got styles to work right yetwith my grid that get's dynamically populated by xml files.Here's my code that gets the grid.

private void mnuContacts_Cli ck(object sender,
System.EventAr gs e)
{
string fn="C:\\applica tionRoot\\data\ \salesdata.xml" ;
DataSet ds=new DataSet();
ds.ReadXml(fn);
lbTables.Items. Clear();
foreach (DataTable dt in ds.Tables)
{
lbTables.Items. Add(dt.TableNam e);
}
dataSet=ds;
lbTables.Select edIndex=0;
fnSchema=fn;
this.Text="Your Company - "+fnSchema;
}
.

Nov 15 '05 #2

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

Similar topics

2
3258
by: Tamlin | last post by:
Hi all, I'm getting a bug with the datagrid object. I've created one from scratch, bound it to a dataview with 2 int32 columns and formatted the output as currency. I've found that when you use the F2 key to enter edit mode and then hit TAB or ESCAPE without actually editing the value, dotnet crashes with a null reference error.
1
1987
by: Stephen | last post by:
I have a datagrid and i'm trying to fix the width of one of the columns to be exactly 300px. My problem is that one of the records fields(CompanyName) is really long and has no spaces so it streches the whole datagrid accross the screen. Has anyone else ever experienced this problem and is there any way of fixing it. Basically my datagrid is...
2
2732
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx. The problem is the article is in VisualBasic. I already get the collection to be recognized as a Data Source by the IDE. It populated the DataGrid...
1
6562
by: Nicole | last post by:
Like many before me, I am tearing my hair out trying to get Acrobat 6.0 to work with VBA. I am getting close, and the error I am getting now seems like it should be easy to surmount. So why am I stumped?! ;) This code is in the middle of a large module in an ADP that takes web data and ports it to an MS Word form that is dynamically...
3
4251
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found several examples on the web. They all seem to have problems, though that I've been unable to resolve. The most promising example I have found is...
3
5030
by: Ryan Liu | last post by:
Hi there, I got a NullReferenceException when delete last row in a datagrid. I had hard time to solve since it does not occur in my own code. I put a datagrid in my inherited user control, then put this control on a form. I use DataAdaptor to fill the data table and update database.
1
1191
by: Gordon | last post by:
Hi; What is the correct way to expand a column width to display data bound to it ? Is it merely setting the control.width property ? Thanks -- Gordon
1
3788
by: seanmle | last post by:
I want to build a windows application that has a datagrid filled with data. When a person modifies information on a single cell, it updates the database without the user having to click on a save button. Any ideas on how I can accomplish this? Thanks, Sean
4
12426
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.