Solved

vb.net 2008 Datagridview Disable Edit on colunm

Posted on 2009-04-07
5
3,009 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

808 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