Windows Develop Bookmark and Share   
 index > Windows Forms General > how to programmatically set column field(s) to read-only?
 

how to programmatically set column field(s) to read-only?

hi guys,

i just wanna know how to programmatically set column field(s) to read-only

sairenji  Thursday, July 23, 2009 9:01 AM

you can set column fields to read only as below :

frmNew.DataGridView1.Columns(0).ReadOnly = True

Replace 0 by Column number or column name.


Vicky
Vikram Gorla  Thursday, July 23, 2009 10:18 AM

you can set column fields to read only as below :

frmNew.DataGridView1.Columns(0).ReadOnly
 = True

Replace 0 by Column number or column name.


Vicky
the ...Columns(0) is not working, instead i changed it to Columns[0] and the build was successful

i did your suggestion, but it didn't worked.
but when i ran the form, and fired the event,
The columns still didn't changed to ReadOnly = true
sairenji  Friday, July 24, 2009 1:51 AM
what is the exception, which is raised?
Vicky
Vikram Gorla  Friday, July 24, 2009 5:03 AM
there's no exception, its just there is no result occurs.

e.g. when i click the add, the DataGridView column 1 should be programatically set ReadOnly to false, but its not happening.
sairenji  Friday, July 24, 2009 5:13 AM
could you please paste the code sample, and tell me what you are trying to do, so that i can help you further
Vicky
Vikram Gorla  Friday, July 24, 2009 7:56 AM

We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Tuesday, July 28, 2009 2:43 AM

You can use google to search for other answers

Custom Search

More Threads

• Remote Agent install
• Recommendations for 3rd party Windows TreeView & ListView controls
• Progress execution when SQL running
• This Database is a Monster
• Generating and writiing into excel file programatically through C#.net and ODBC Driver
• how to make two buttons, which are into tablelayoutpanels, exactly the same in all the app
• get a cookie from the axwebbrowser control
• How can I let the user customize which items to show in the toolstrip?
• Beginner Question regarding the Graphics object and Mouse events
• How to programatically close a form which has a Font/Color Dialog opened