Click here to Skip to main content
13,149,738 members (53,845 online)
Rate this:
Please Sign up or sign in to vote.
I want datagrid rows in disabled state when edit event is called.I cant disable the datagrid at that time as i need scrollbar also..So please help me
Posted 17-Feb-12 22:31pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Dear Friend,

You can not disable a datagridview row. The only thing you can do is make it readonly.

Private Sub Button8_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button8.Click
    For Each band As DataGridViewBand In dataGridView.Columns
        band.ReadOnly = True
End Sub

In edit mode add this line:-

DataGridView1.ReadOnly = True[^]

try this:-[^]

Please try these link:- To make any column readonly in Datagrid[^][^][^]

I hope this will help you out.
sofia3 18-Feb-12 5:29am
Its not effect on it:(
Varun Sareen 18-Feb-12 5:56am
have you tried the link? and plese sofia don't repost the same question, ask what ever you want to ask here only in this question only. OK?
sofia3 18-Feb-12 6:18am
This is also not working..Kindly hv a look
sofia3 18-Feb-12 6:12am
Dear varun its not working..i hv tried this also..Please suggest some more
sofia3 18-Feb-12 6:13am
default property of datagrid readonly is false
sofia3 18-Feb-12 6:15am
please help me i am in big trouble..
Varun Sareen 18-Feb-12 11:46am
Dear Sofia, i have updated my answer. Please check the last three links..I hope they will get you through with your problem. Do accept the solution if it really helps you out.

sofia3 19-Feb-12 23:32pm
Dear varun thanks 4 ur concern:) But am so sorry to say still it is not working..:(
sofia3 19-Feb-12 23:42pm
and there is no event as dataGrid1_LoadingRow in datagrid..
Varun Sareen 20-Feb-12 11:28am
dear sofia try to analyze your code closely..may be you are doing wrong somewhere as this is the only line of code with which you can make a datagrid rows disable
Varun Sareen 18-Feb-12 7:08am
I will send you the solution for it after some time :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


try this..


do the same for how many columns you have...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170924.2 | Last Updated 21 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100