dataGrid word wrap in windows forms.

  • Thread starter Thread starter Bernerd
  • Start date Start date
B

Bernerd

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_Click(object sender,
System.EventArgs e)
{
string fn="C:\\applicationRoot\\data\\salesdata.xml";
DataSet ds=new DataSet();
ds.ReadXml(fn);
lbTables.Items.Clear();
foreach (DataTable dt in ds.Tables)
{
lbTables.Items.Add(dt.TableName);
}
dataSet=ds;
lbTables.SelectedIndex=0;
fnSchema=fn;
this.Text="Your Company - "+fnSchema;
}
 
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
 
Back
Top