# Visual Basic > Universal Windows Platform and Modern Windows Experience >  WPF Change a DataGrid column from Read/Wright to Read only in back code.

## tonyallan8128

Hello , I have a Datagrid set up this way.



```
 <DataGrid x:Name="dgTop" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Height="48" RowHeaderWidth="0" AutoGenerateColumns="False" CanUserAddRows="True" CanUserResizeColumns="False" CanUserDeleteRows="False" ScrollViewer.CanContentScroll="True" VerticalScrollBarVisibility="Hidden">

                    <DataGrid.Columns>
                <DataGridTemplateColumn Header="Seq" Width="50*">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBox Name="txtSeq" Text="{Binding SEQ, Mode=OneWay}" MouseDoubleClick="txtSeq_MouseDoubleClick" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
```

I wish to set column Seq to Read only using visual basic.
Something like this.
*dgTop.Columns(0).Isreadonly = True*
Could someone please show me what im doing wrong ?

----------


## KGComputers

I use DataGridTextColumn instead of TemplateColumn since DataGridTextColumn inherits DataGridColumn class.

DataGridTextColumn Class

Xaml

XAML Code:
<DataGridTextColumn Header="Name" Binding="{Binding SEQ, Mode=OneWay}" Width="50" />


VB.NET Code:
dgTop.Columns(0).IsReadOnly = True

----------

