Datagrid VB net

F

Frantz

Hello,
I want to resize a the columns of a datagrid one by one. I can not find a
way to do it in vb net.
Thanks for your help.
Frantz
 
J

jvb

Fratnz,

Take a look at the DataGridTableStyles class. I think that may be what
you are looking for.
 
J

jvb

Try something like this

Private Sub Form1_Load(ByVal sender as Object, byval e as
System.EventArgs) Handles MyBase.Load

Me.DataGrid1.TableStyles.Add(CreateTableStyle("TableName"))

End Sub

Private Function CreateTableStyle(ByVal TableName As String) as
DataGridTableStyle
Dim MyColumn As New DataGridTextBoxColumn
Dim ReturnStyle As New DataGridTableStyle

ReturnStyle.MappingName = TableName

'Define Columns Here

ReturnStyle.GridColumnStyles.Add(MyColumn)

Return ReturnStyle

End Function
 
H

Homer J Simpson

I want to resize a the columns of a datagrid one by one. I can not find a
way to do it in vb net.

Me.DataGridView1.Columns(0).Width = 222
Me.DataGridView1.Columns(1).Width = 333
.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top