How to access the data grid inside a custom control?

Clash Royale CLAN TAG#URR8PPP
How to access the data grid inside a custom control?
I'm a newbie and I decided to enhance my program's GUI using Krypton Toolkit.
I was able to load it into my project.
The issue that I have created a control with name mycontrol which have a KryptonDataGridView with name mydatagrid.
mycontrol
mydatagrid
In my form, I have the following code:
public partial class Form1 : KryptonForm
private KryptonPage mycontrolpage;
private Control mycontrolcontent;
public Form1()
InitializeComponent();
private KryptonPage NewmycontrolPage()
mycontrolcontent = new mycontrol();
KryptonPage page = new KryptonPage("mypage", null, "OS mypage");
// Add the control for display inside the page
mycontrolcontent.Dock = DockStyle.Fill;
page.Controls.Add(mycontrolcontent);
// Document pages cannot be docked or auto hidden
page.ClearFlags(KryptonPageFlags.DockingAllowAutoHidden
private void Form1_Load(object sender, EventArgs e)
// Setup docking functionality
KryptonDockingWorkspace w = kryptonDockingManager.ManageWorkspace(kryptonDockableWorkspace);
kryptonDockingManager.ManageControl(kryptonPanel, w);
kryptonDockingManager.ManageFloating(this);
mycontrolpage = new KryptonPage NewmycontrolPage() ;
kryptonDockingManager.AddToWorkspace("Workspace", mycontrolpage);
My problem is how to access the grid in mycontrol?
mycontrol
mycontrol
mycontrol
Control
private Control mycontrolcontent
private mycontrol mycontrolcontent
mycontrol
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
We would need to see the code of your
mycontrolclass, at least the part that is related to the KryptonDataGridView child control. That being said, as a start, you should declare your variable of typemycontrol, notControl. Replaceprivate Control mycontrolcontentwithprivate mycontrol mycontrolcontent, that could solve your problem if you just can't access the properties of that object. One last thing, you should use meaningful names for your controls and variables; don't use names likemycontrolas it has no meaning to someone else (might be you in the future) reading the code.– Ahmed Abdelhameed
3 hours ago