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

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
commented: Thank you for sharing +16
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.