Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
VB.Net DataGridView Cell Editable
Old 03-09-2012, 02:58 PM VB.Net DataGridView Cell Editable
Experienced Talker

Posts: 39
Name: remya
Trades: 0
I’m using VB.Net.

I’m using DataGridView with ColumnType = DataGridViewTextBoxColumn.

I have 3 columns. Column1, Column2, Column3.

For example:
Code:
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.

Code:
DataGridView1.Item(2, CountR).ReadOnly = False 

Code:
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.
remya1000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-11-2012, 04:45 AM Re: VB.Net DataGridView Cell Editable
Experienced Talker

Posts: 39
Name: remya
Trades: 0
i think i'm executing that code multiple times with different row indexes.

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

Code:
                For Each r As DataGridViewRow In DataGridView1.Rows
                    If r.Cells(3).Value.ToString = "EDIT" Then
                        r.Cells(3).ReadOnly = False
                    Else
                        r.Cells(3).ReadOnly = True
                    End If
                Next
remya1000 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to VB.Net DataGridView Cell Editable
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13544 seconds with 11 queries