Accessing array of child objects in c# RRS feed

  • Question

  • I am having a scenario like the following in datagridView - CellPaintingEvent

    object cellValue = e.FormattedValue;

    through the above sequence i am getting array of values sometimes i.e:

    cellValue = system.object[];

    pls let me know how to access all those child objects value.

    Thanks in advance


    • Moved by CoolDadTx Monday, November 18, 2019 2:54 PM Winforms related
    Monday, November 18, 2019 10:37 AM

All replies

  • Hi siddmuthu,

    About “how to access all those child objects value”, you can use foreach statement to traverse it and extract the objects.

    You can refer to the following code.

    foreach (object o in cellValue)

    Best Regards,

    Daniel Zhang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Tuesday, November 19, 2019 6:13 AM
  • Hello,

    It's been a while, just checking to see if Daniels code assisted in resolving your issue or not. If so please mark their reply as a) helpful or b) the answer so others with the same or similar question can benefit from knowing if this solved the issue or not.

    Thanks for understanding 

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Friday, December 6, 2019 6:44 PM