Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to change column settings from DataReader columns?

Posted on 2009-05-05
4
Medium Priority
?
213 Views
Last Modified: 2012-05-06
Hello,

I have a datagridview with 8 columns.

2 columns are created manually and the other 6 are from a DataReader assigned to the datagridviews datasource.

The 2 columns I have set the property ReadOnly = false; because the user must enter data, but the other 6 columns are editable too, how can I stop that? User is not allowed to enter data here. How can I access the 6  columns after the DataReader is bound to the datagridviews datasource?
0
Comment
Question by:MSFanboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 6

Expert Comment

by:Cebik
ID: 24304634

foreach (DataGridViewColumn col in dataGridView1.Columns)
    col.ReadOnly = true;

Open in new window

0
 
LVL 6

Accepted Solution

by:
Cebik earned 2000 total points
ID: 24304658
sorry :)

for (int i=2; i<dataGridView1.Columns.Count; i++)
    dataGridView1.Columns[i].ReadOnly = true;

Open in new window

0
 

Author Comment

by:MSFanboy
ID: 24304913
thx a bunch :) totally forgot the i=2 possibility... thought I have to if... the column hehe
0
 
LVL 6

Expert Comment

by:Cebik
ID: 24304980
:)
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

618 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