newbie - datagrid formatting

G

Guest

Hi!

My problem is that I can't format the datagrid (WindowsForm) in a WinCE
application. I'm working with VS .NET 2003.
What I want is to give a headertext to the columns and to adjust
programatically the width.
The solutions in the help and in the newsgroups doesn't work.

I have already bound a DataSet to the Datagrid, and it appears correctly
except the columns' header and their width.

This is my code:

Dim ts As New DataGridTableStyle
Dim dgc As DataGridColumnStyle
dgc = New DataGridTextBoxColumn
dgc.HeaderText = "Col 1"
dgc.MappingName = "Fieldname1"
ts.GridColumnStyles.Add(dgc)

thanks for help in advance
 
G

Guest

OOOps, I haven't copied the last row here, so it's the full code:

Dim ts As New DataGridTableStyle
Dim dgc As DataGridColumnStyle
dgc = New DataGridTextBoxColumn
dgc.HeaderText = "Col 1"
dgc.MappingName = "Fieldname1"
ts.GridColumnStyles.Add(dgc)
DataGridDrugList.TableStyles.Add(ts)
 

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