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 9200719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:49:50+00:00 2026-06-17T22:49:50+00:00

I have DataGridView binded on collection of some objects. In DataGridView , there’s one

  • 0

I have DataGridView binded on collection of some objects. In DataGridView, there’s one ComboBox with list of names, I’m trying to add new object to collection on every selection.
But problem is that AddNew() always call default constructor of child. :/
Here’s a code:

public class Parent:BindingList<Child>

public Child ChildProperty{get;set;}

public new object AddNew()
    {
        return ChildProperty;
    }

public new void AddingNew(object sender, AddingNewEventArgs e)
    {
        ChildProperty = new Child(this);
        e.NewObject = ChildProperty;
    }

I must use parameterized constructor, because i need to pass parent to child.

  • 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-17T22:49:51+00:00Added an answer on June 17, 2026 at 10:49 pm

    By using the new keyword, you aren’t overriding the base class’ methods; instead, you’re creating brand new methods in the derived class only, which are never called.

    Instead, you should override the AddNewCore() method and return a new object.

    EDIT: You also need to Add() the new instance to the collection in your override.

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

Sidebar

Related Questions

Background I have a custom collection that is binded to the datagridview this.datagridview.DataSource =
I have created a binded DataGridView that has one single column. I want to
I have binded a datagridview with the database and I am trying to set
in asp.net 3.5[vs2008] Gridview i got one issue. i have binded objectdatasource with datagridview,
I have a binded DataGridView that allows adding new rows. The problem is that
I have a DataGridView object to which I've bound a list of objects (of
i have datagridview which has one combobox column. i populate combobox column. when i
I have a DataGridView and I need to add custom objects to it. Consider
I have datagridview with checkbox column, but I want, that some of the columns
I have a DataGridView binded to this table: [Users] ID Name -- ---- 11

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.