Hello,

I have a form containing a datagridview and a groupbox containing 2 radiobuttons.
If radiobutton 1 is selected only the order headers are shown.
If radiobutton 2 is selected only the orderlines are shown.
There also is a button called "show". When clicked the dgv gets filled with data.

Here is my problem.

When I first select radiobutton 2 (orderlines) and I press the show button the columns in the DGV are in the right order (as shown in the code "strview").

If I select radiobutton 1 still the columns are in the right order.

HOWEVER...when I now select radiobutton 2 the order of the columns get all messed up.

Code:
    If Me.radOrder.Checked = True Then 'ORDERHEADERS
      strView = Nothing
      strView = String.Format("SELECT DISTINCT InkoopVerkoop,Order_ID,OrderNummer,Omschrijving,Order_Datum,VolledigeNaamBestel,Status,NaamRelatie, " & _
                              "OrdNumLev,Geannuleerd,Geleverd,LeverDatum FROM qryORDER ")
    End If

    If Me.radOrderregels.Checked = True Then 'ORDERLINES
      strView = Nothing
      strView = String.Format("SELECT DISTINCT InkoopVerkoop,Order_ID,OrderNummer,Omschrijving,Order_Datum,VolledigeNaamBestel,Artikel,ArtOmschrijving,Aantal,PrijsEenheid, " & _                            "Status,NaamRelatie,OrdNumLev,Geannuleerd,Geleverd,LeverDatum FROM qryORDER ")
    End If

   
    Dim SampleSource As New DataSet
    Dim TableView As DataView
    Dim SampleCommand As New SqlCommand()
    Dim SampleDataAdapter = New SqlDataAdapter()
    SampleCommand.CommandText = strOrder_SQL
    SampleCommand.Connection = connection
    SampleDataAdapter.SelectCommand = SampleCommand
    SampleDataAdapter.Fill(SampleSource)
    TableView = SampleSource.Tables(0).DefaultView

    If Me.radOrder.Checked = True Then 'ORDER HEADERS
      With dgvZoek
        .DataSource = TableView
        .Columns(0).Width = 40
        .Columns(0).HeaderText = "Type"
        .Columns(1).Width = 30
        .Columns(1).HeaderText = "ID"
        .Columns(2).Width = 75
        .Columns(2).HeaderText = "Order"
        .Columns(3).Width = 150
        .Columns(3).HeaderText = "Omschrijving"
        .Columns(4).Width = 100
        .Columns(4).HeaderText = "Order datum"
        .Columns(5).Width = 150
        .Columns(5).HeaderText = "Besteller"
        .Columns(6).Width = 75
        .Columns(6).HeaderText = "Status"
        .Columns(7).Width = 150
        .Columns(7).HeaderText = "Relatie"
        .Columns(8).Width = 75
        .Columns(8).HeaderText = "OrderLev"
        .Columns(9).Width = 75
        .Columns(9).HeaderText = "Geannuleerd"
        .Columns(10).Width = 75
        .Columns(10).HeaderText = "Geleverd"
        .Columns(11).Width = 100
        .Columns(11).HeaderText = "Lever datum"
      End With
    End If

    If Me.radOrderregels.Checked = True Then 'ORDERLINES
      With dgvZoek
        .DataSource = TableView
        .Columns(0).Width = 40
        .Columns(0).HeaderText = "Type"
        .Columns(1).Width = 30
        .Columns(1).HeaderText = "ID"
        .Columns(2).Width = 75
        .Columns(2).HeaderText = "Order"
        .Columns(3).Width = 150
        .Columns(3).HeaderText = "Omschrijving"
        .Columns(4).Width = 100
        .Columns(4).HeaderText = "Order datum"
        .Columns(5).Width = 150
        .Columns(5).HeaderText = "Besteller"
        .Columns(6).Width = 75
        .Columns(6).HeaderText = "Artikel"
        .Columns(7).Width = 150
        .Columns(7).HeaderText = "Artikel omschrijving"
        .Columns(8).Width = 75
        .Columns(8).HeaderText = "Aantal"
        .Columns(9).Width = 75
        .Columns(9).HeaderText = "Prijs/ST"
        .Columns(10).Width = 100
        .Columns(10).HeaderText = "Status"
        .Columns(11).Width = 100
        .Columns(11).HeaderText = "Relatie"
        .Columns(12).Width = 100
        .Columns(12).HeaderText = "OrderLev"
        .Columns(13).Width = 75
        .Columns(13).HeaderText = "Geannuleerd"
        .Columns(14).Width = 75
        .Columns(14).HeaderText = "Geleverd"
        .Columns(15).Width = 100
        .Columns(15).HeaderText = "Lever datum"
      End With
    End If
I hope you guys can point out what I am doing wrong.

Thanks in advance!!!