Note that there are some explanatory texts on larger screens.

plurals
  1. POC# call MDI child from child form
    text
    copied!<p>I have these forms:</p> <p>MainScreen - <em>MDI container</em><br> DataBaseOutput - <em>child</em><br> NewAnime - <em>child</em> </p> <p>DataBaseOutput has a tab control that holds datagrids, each for different tables. I use an access database. </p> <p>In those tabs, there is a menustrip, where the functions "New", "Edit", "Delete" etc. will be called from. Now when I'm on the first tab's menustrip and click on "New" I want to open the form "NewAnime", inside the MDI container. This however, is not working as I planned. At first I tried to just call it from the childform (DataBaseOutput). This resulted in opening a new form instead of a child. when I made it a child it was not showing up.</p> <p>Then I triend lots of things, but I still haven't figured it out.</p> <p>This is the current code for calling the form. It calls the form with a method in the main form:</p> <pre><code>private void NewAnime_Click(object sender, EventArgs e) { MainScreen main = new MainScreen(); main.mShowForm(2); this.Close(); } </code></pre> <p>Method in the main form:</p> <pre><code>// Forms for MDI Parent DataBaseOutput OutputForm = new DataBaseOutput(); NewAnime AddAnime = new NewAnime(); // How i made them childs (this is at the InitializeComponent(); part) OutputForm.MdiParent = this; AddAnime.MdiParent = this; public void mShowForm(int formnumber) { switch (formnumber) { case 1: OutputForm.Show(); break; case 2: AddAnime.Show(); break; } } </code></pre> <p>Does anyone have a clue of what i'm doing wrong and maybe has a better idea? This might be a bit too much working around, but as I said, it's my first time using MDI forms and i'm just trying to get it to work.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload