Solved

vb.net 2008 Datagridview Disable Edit on colunm

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

26 Experts available now in Live!

Get 1:1 Help Now