Click here to Skip to main content
Sign Up to vote bad
good
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
sofia3707


2 solutions

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
    Next
End Sub
 
In edit mode add this line:-
 
DataGridView1.ReadOnly = True
 
http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridviewrow.readonly.aspx[^]
 
try this:-
 
http://vb.net-informations.com/datagridview/vb.net_datagridview_database.htm[^]
 
Please try these link:- To make any column readonly in Datagrid[^]
 
http://forums.silverlight.net/t/235161.aspx/1[^]
 
http://www.devx.com/dotnet/Article/33748/0/page/3[^]
 
I hope this will help you out.
  Permalink  
Comments
sofia3 - 18-Feb-12 5:29am
Its not working..no 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. Thanks
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 :)
Hi
 
try this..
 
Gridview1.Columns(x).ReadOnly=True
 
do the same for how many columns you have...
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 448
1 Ron Beyer 286
2 samadhan_kshirsagar 229
3 OriginalGriff 223
4 Tadit Dash 213
0 Sergey Alexandrovich Kryukov 7,017
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,372
4 CPallini 3,010


Advertise | Privacy | Mobile
Web02 | 2.6.130619.1 | Last Updated 21 Feb 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid