how to set new width to datagrid

alaric

Well-known member
Joined
Oct 12, 2005
Messages
53
Programming Experience
Beginner
Hi,

cant figure out where to set the new datagrid width to fit all the columns.
I define a tablestyle and count the total width of the columns

Oke this is what i do (try)

1. load the form
2. add dgStyle to datatable
(here I calculate (intdgCursWidth) the width of all colums, which I want to use for adjusting the width of the datagrid)
3. bind datatable to datagrid

But in whatever event I put this line:
VB.NET:
[SIZE=2][COLOR=#0000ff]
Me[/COLOR][/SIZE][SIZE=2].dgCursisten.Width = intdgCursWidth
[/SIZE]
The datagrid is NOT resized to the calc size (intdgCursWidth)

Cant figure this out, where do I put this line of code?
Someone? ideas? solutions?

thanks
 
[resolved]

Found it!
Just before adding the TS to the DT

VB.NET:
[SIZE=2][COLOR=#0000ff]
Me[/COLOR][/SIZE][SIZE=2].dgCursisten.Width = dgCursWidth + 56 [/SIZE][SIZE=2][COLOR=#008000]'56 is width of rowheader
[/COLOR][/SIZE][SIZE=2]dgCursisten.TableStyles.Add(tsCursisten)
[/SIZE]

thx
 
Back
Top