Solved

How to change column settings from DataReader columns?

Posted on 2009-05-05
4
210 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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 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