How to set the datagird/view column width dynamically?

I have a datagrid, being populated by a dynamic dataset. When I display them, it shows the each column with fixed width, for example, 'DATE' and 'INVOICE_CREATION_DATE' are of same width and it comes like this 'DATE ' and 'INVOICE_CRE'. I wanted to adjust the column width depending on the length of column. Since I am populating dynamically, I know the name of the column and the length of teh columns. But I do not know how to set it? Do I need to set it at datagrid or dataset ...I do not know. Any help/guide/pointers how to do it?

Thanks in advance.

Jil.

[573 byte] By [Jil] at [2007-12-17]
# 1
Any help please!

Jil

Jil at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2
Are you using .NET 1.x or 2.0?

The 2.0 DataGridView has a Columns collection, where you can set the width of a column:



dataGridView1.Columns[0].Width = 100;


For 1.x, see here: http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q792q

DanielRieck at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms General...