1.11M Members

.NET CF 2.0: DataGrid Column resizing question

 
0
 

Hi there,

In a form i have a datagrid with two columns. The columns are about 40 pixels wide and i can't find a way to have them larger when the program loads. Does anyone know a way to do this?

Greets,

K

 
1
 

I Solved it, here is the code:

Sub DoTableStyling()


        Dim RegStyle As New DataGridTableStyle
        RegStyle.MappingName = FoundSituations.TableName

        'Oorzaakcolom
        Dim CauseColumn As New DataGridTextBoxColumn
        CauseColumn.MappingName = FoundSituations.Columns.Item(0).ColumnName.ToString()
        CauseColumn.HeaderText = FoundSituations.Columns.Item(0).ColumnName.ToString()
        CauseColumn.Width = 98
        RegStyle.GridColumnStyles.Add(CauseColumn)

        'Situatiekolom
        Dim SitColumn As New DataGridTextBoxColumn
        SitColumn.MappingName = FoundSituations.Columns.Item(1).ColumnName.ToString()
        SitColumn.HeaderText = FoundSituations.Columns.Item(1).ColumnName.ToString()
        SitColumn.Width = 266
        RegStyle.GridColumnStyles.Add(SitColumn)

        'Opgelostcolom
        Dim SolveColumn As New DataGridTextBoxColumn
        SolveColumn.MappingName = FoundSituations.Columns.Item(2).ColumnName.ToString()
        SolveColumn.HeaderText = FoundSituations.Columns.Item(2).ColumnName.ToString()
        SolveColumn.Width = 99
        RegStyle.GridColumnStyles.Add(SolveColumn)

        RegSituation.TableStyles.Clear()
        RegSituation.TableStyles.Add(RegStyle)
        RegSituation.DataSource = FoundSituations
    End Sub
Question Self-Answered as of 3 Years Ago
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: