Click to See Complete Forum and Search --> : Columns in Datagrid


gnacz
December 27th, 2002, 08:36 AM
How can I change width of columns in Datagrid?

( System.Windows.Forms.DataGrid)

pareshgh
December 27th, 2002, 01:45 PM
on datagrid properties
click TableStyles or access it via in code.
its a collection.
select the DataGridTableStyle object and then
goto
DataGridColumnStyle which is again collection
via this you could change the width. and

it will reflect the output.

prefferedrowwidth is to change the row width.

this.objTableStylegrdEmpmasterEmpmaster.PreferredColumnWidth = 200;

this.objTableStylegrdEmpmasterEmpmaster.PreferredRowHeight = 60;

hope it helps
-Paresh

gnacz
December 30th, 2002, 12:06 PM
Thanks, Paresh.

I had trouble with that because I forgot set "Mapping Name" :(

It's strange but I can't set Width to 100 pt per column!?
Bigger or smaller values works. :)

Gnacz.