Solved

vb.net 2008 Datagridview Disable Edit on colunm

Posted on 2009-04-07
5
2,975 Views
Last Modified: 2013-11-26
i use datagridview on vb.net 2008 .how to not allow user to edit only column 1 and column 12
0
Comment
Question by:aarontham
  • 3
  • 2
5 Comments
 
LVL 17

Expert Comment

by:NicksonKoh
ID: 24094265
Did you try setting the field to just read only as in ReadOnly="True"?
0
 
LVL 9

Expert Comment

by:Sreedhar Vengala
ID: 24094271
           p2pDataContext p = new p2pDataContext();
           
            dataGridView1.DataSource = (from a in p.Stockpiles select a).ToList();
            dataGridView1.Columns[0].ReadOnly = true;
            dataGridView1.Columns[1].ReadOnly = true;
0
 
LVL 9

Expert Comment

by:Sreedhar Vengala
ID: 24094275
for col 1 and 12 to make readlnly (non editable)
dataGridView1.Columns[1].ReadOnly = true;
dataGridView1.Columns[12].ReadOnly = true;
0
 
LVL 9

Accepted Solution

by:
Sreedhar Vengala earned 500 total points
ID: 24094281
VB:
dataGridView1.Columns(1).[ReadOnly] = True
dataGridView1.Columns(12).[ReadOnly] = True
0
 
LVL 17

Expert Comment

by:NicksonKoh
ID: 24094284
Here's how u do in design mode.
<Columns>

    <asp:BoundField DataField="Column1" HeaderText="Column1" ReadOnly="True" SortExpression="Column1" />

    <asp:BoundField DataField="Column2" HeaderText="Column2"  SortExpression="Column2" />

</Columns>

Open in new window

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now