Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Winform Datagrid VB.NET Permissions

Rand626Rand626 Member Posts: 3
My question is this:

I have a Winform (VB.NET) application that uses a Datagrid. What I want to know is, if there is a way to set column level permission in the grid. Such as User1 can change col1, col2 but not col3. Something along those lines.

Comments

  • tpwellstpwells Member Posts: 15
    : My question is this:
    :
    : I have a Winform (VB.NET) application that uses a Datagrid. What I want to know is, if there is a way to set column level permission in the grid. Such as User1 can change col1, col2 but not col3. Something along those lines.
    :
    :

    I have not tested this but it seems that this may work. Of course you will need to modify to fit oyur needs. Pay attention to the TablyeStyle and GridColumnStyles indexes if you have more than one of each defined on your grid (they do take the name of the style to use instead of interger index as well).

    For i As Integer = 0 To CType(DataGrid1.DataSource,DataSet).Tables(0).Columns.Count - 1
    If i = 0 Or i = 1 Then
    DataGrid1.TableStyles(0).GridColumnStyles(i).ReadOnly = False
    Else
    DataGrid1.TableStyles(0).GridColumnStyles(i).ReadOnly = True
    End If
    Next
Sign In or Register to comment.