Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7726521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:14:12+00:00 2026-06-01T05:14:12+00:00

The DatagridviewCell.Datagridview property is read-only. Same applies for other datagridview elements with a Datagridview

  • 0

The DatagridviewCell.Datagridview property is read-only. Same applies for other datagridview elements with a Datagridview reference, like rows and columns. Yet somehow when you add/remove elements from a datagridview, this property is set properly behind the scenes, so there is never any inconsistency between the parent datagridview’s references to its elements, and vice versa.

How is datagridview accomplishing this? I’m trying to do something similar myself. The only “trick” that I know of is to put the collection definition inside the class definition or vice versa, so that the element or collection has access to other’s private fields, but looking at the datagridview namespaces this does not appear to be the case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:14:13+00:00Added an answer on June 1, 2026 at 5:14 am

    The DateGridView is using the “internal” access modifier. As you may know, there are 4 different access modifiers.

    public    string MyPetPeeve
    private   string MyPetPeeve
    protected string MyPetPeeve
    internal  string MyPetPeeve
    

    Here’s a quick summary of the behaviour of the access modifiers:

    public: MyPetPeeve is accesible to anyone who wants to know.

    private: MyPetPeeve is only accessible from within the class or struct that contains it.

    protected: MyPetPeeve is accessible to the class or struct that contains it. PLUS, any class derived from MyPetPeeves containing class.

    internal: MyPetPeeve is accessible to any class or struct that exists in the same assembly. For example, the DataGridView exists in the System.Windows.Forms assembly, so any class or struct found in System.Windows.Forms can change DatagridviewCell.Datagridview property. To anyone else outside System.Windows.Forms, in this case: you, it appears to be private.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView that is populated with 4 columns and multiple rows of
Some columns of my datagridview are link columns. Based on data fetched I'd like
I'm making a DataGridView with a series of Checkboxes in it with the same
DataGridView, for example, lets you do this: DataGridView dgv = ...; DataGridViewCell cell =
I have a question about datagridviewcell. i have created textboxcolumn in datagridview. when ever
I'm trying to export only the selected checkbox items on a datagridview. The current
I have a DataGridView in virtual mode. I only implemented the CellValueNeeded eventhandler as
I am using this code to export DataGridView rows to an Excel sheet. Excel.Application
i need to paint only background of DataGridView cell not its Content.But while i'm
Is there a way to let only certain chars be added to a datagridview

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.