Hi @OmkarHcl , Welcome to Microsoft Q&A.
This is totally doable.
What you need to do is pass target datagridview as parameter to custom datagridview.
Put the following code into the constructor of the custom control.
private DataGridView formDataGridView;
public smartdatagridview(DataGridView formDataGridView)
{
this.formDataGridView = formDataGridView;
InitializeComponent();
}
Then create it manually in form1.
smartdatagridview sd = new smartdatagridview(dataGridView1);
Controls.Add(sd);
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.