Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows VB.NET DataGrid
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 23:31pm
sofia3727
Rate this: bad
good
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
    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  
v6
Comments
sofia3 at 18-Feb-12 5:29am
   
Its not working..no effect on it:(
Varun Sareen at 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 at 18-Feb-12 6:18am
   
This is also not working..Kindly hv a look
sofia3 at 18-Feb-12 6:12am
   
Dear varun its not working..i hv tried this also..Please suggest some more
sofia3 at 18-Feb-12 6:13am
   
default property of datagrid readonly is false
sofia3 at 18-Feb-12 6:15am
   
please help me i am in big trouble..
Varun Sareen at 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 at 19-Feb-12 23:32pm
   
Dear varun thanks 4 ur concern:) But am so sorry to say still it is not working..:(
sofia3 at 19-Feb-12 23:42pm
   
and there is no event as dataGrid1_LoadingRow in datagrid..
Varun Sareen at 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 at 18-Feb-12 7:08am
   
I will send you the solution for it after some time :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
0 Sergey Alexandrovich Kryukov 269
1 OriginalGriff 240
2 CPallini 195
3 Maciej Los 177
4 BillWoodruff 173
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 21 Feb 2012
Copyright © CodeProject, 1999-2014
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