Click here to Skip to main content
15,877,376 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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

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.
 
Share this answer
 
v6
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
Hi

try this..

VB
Gridview1.Columns(x).ReadOnly=True


do the same for how many columns you have...
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900