Results 1 to 2 of 2

Thread: [RESOLVED] VB.Net DataGridView Cell Editable

  1. #1
    Join Date
    May 2007

    resolved [RESOLVED] VB.Net DataGridView Cell Editable

    Iím using VB.Net.

    Iím using DataGridView with ColumnType = DataGridViewTextBoxColumn.

    I have 3 columns. Column1, Column2, Column3.

    For example:
    Column1          Column2          Column3
    1                        AA                AAA
    2                        BB                EDIT
    3                        CC                CCC
    If column3ís value = ďEDITĒ, then I need to edit only that cell.

    Here for example: i need to make the Column3ís second cell to be readonly=false.

    So i cannot make any changes to (1, AA, AAA), (3, CC, CCC) and (2, BB). Need to make changes only EDIT cell.

    I tried this code. CountR is the row in which EDIT values is there.

    DataGridView1.Item(2, CountR).ReadOnly = False
    DataGridView1.Rows(CountR).Cells(2).ReadOnly = False
    But this makes every cell in column editable.

    Is there a way i can make some cells editable in column?

    If you know how to do it, please help me. if you can provide an example, then that will be so helpful.

    Thanks in Advance.

  2. #2
    Join Date
    May 2007
    i think i'm executing that code multiple times with different row indexes.

    So i try this code, and it's working...

                    For Each r As DataGridViewRow In DataGridView1.Rows
                        If r.Cells(3).Value.ToString = "EDIT" Then
                            r.Cells(3).ReadOnly = False
                            r.Cells(3).ReadOnly = True
                        End If

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center