By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

How to set the DataTable rows into non-edit mode?

nayana kalkur
P: 4
Hi,

I have developed a new tool window for my addin. I have added a user control to the tool window so that i can populate the output of some function in that data grid present in the tool window.
In the data grid i have created a data table which has rows. When i click on the rows in the data table, i am able to edit them. I want them to be set to non-edit mode, so that the data displayed in the row of the data table is not editable. how can i achieve this?

below is the code about how i have created the data table:

Expand|Select|Wrap|Line Numbers
  1. DataTable d = new DataTable();
  2. DataColumn col = new DataColumn("line_no", typeof(string));
  3. DataColumn col1 = new DataColumn("words", typeof(string));
  4. d.Columns.Add(col);
  5. d.Columns.Add(col1);
  6. foreach (line_num_keywords c in v)
  7.             {
  8.                 DataRow dr = d.NewRow();
  9.                 dr["line_no"] = c.line_number;
  10.                 dr["words"] = c.captured_keyword;
  11.                 d.Rows.Add(dr); 
  12.             }
  13. dataGridView1.DataSource = d;
  14.  
Is there any fucntion which helps me to set the data table to non-edit mode?

Thanks,
Nayana
Dec 31 '08 #1
Share this Question
Share on Google+
2 Replies


vekipeki
Expert 100+
P: 229
I'm not sure if this what you are looking for, but there is a ReadOnly property which you can set for a cell, or entire row/column/DataGridView to make them read-only:

DataGridView.ReadOnly Property (System.Windows.Forms)
Dec 31 '08 #2

nayana kalkur
P: 4
yup! thanks. it helped :)
Dec 31 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.