By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,702 Members | 1,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,702 IT Pros & Developers. It's quick & easy.

Datagrid Column Width Resize Event?

P: n/a
Hello All
I am trying to preserve the width of column in a datagrid
on form load i use this
<code>
Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(0).Width = 30
Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(1).Width = 30
Me.DataGrid2.TableStyles("artenc").GridColumnStyle s(2).Width = 30
</code>

After i update the datagrid dataset i manualy rezised the 3 columns
so that only the 1st letter is visible.
<code>
Dim tableStyle As DataGridTableStyle
tableStyle = New DataGridTableStyle
tableStyle.MappingName = "artenc"
Me.DataGrid2.TableStyles.Clear()
Me.DataGrid2.TableStyles.Add(tableStyle)

WidthDatagrid2(0) = Me.DataGrid2.TableStyles
("artenc").GridColumnStyles(0).Width
WidthDatagrid2(1) = Me.DataGrid2.TableStyles
("artenc").GridColumnStyles(1).Width
WidthDatagrid2(2) = Me.DataGrid2.TableStyles
("artenc").GridColumnStyles(2).Width

Console.WriteLine(Me.DataGrid2.TableStyles
("artenc").GridColumnStyles(1).Width)
Console.WriteLine(Me.DataGrid2.TableStyles
("artenc").GridColumnStyles(1).Width)
Console.WriteLine(Me.DataGrid2.TableStyles
("artenc").GridColumnStyles(2).Width)
Console.WriteLine(WidthDatagrid2(0))
Console.WriteLine(WidthDatagrid2(1))
Console.WriteLine(WidthDatagrid2(2))
</code>
all the console display 75 and i sure the width is not 75!?

Any suggestion on how to store the width of datagrid's column? I
can't any useful event for that.

Thanks

Kind Regards
Jorge

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.