0

I have a Windows Forms C# project. I want to show a splash screen (frmSplash) and then open up an MDI parent (mdi).

I get a compile time error when I try to create an instance of the MDI form. The following code is in frmSplash in the click event of a button:

Form frm;

this.Close();
frm = new mdi();
frm.Show();

I definitely have an MDI parent called 'mdi'. On the line 'frm = new mdi();', the mdi is underlined in red with the error 'The type or namespace name 'mdi' could not be found (are you missing a using directive or an assembly reference?)'. It's in the same project. How could it not see it?

Can I create an instance of an MDI form? If not, how do I create it?

Mark Roworth
  • 409
  • 2
  • 15
  • 2
    are you missing a using directive? Start by typing the namespace name, let the IntelliSense popup be your guide. – Hans Passant Nov 08 '19 at 14:10
  • You are exactly right. Thank you. I have mdi in a subfolder.. Most of my work has been in VB.Net where this doesn't make a difference. Many thanks. – Mark Roworth Nov 08 '19 at 14:15
  • It is not different in vb.net. It is merely less likely to encourage you to use namespaces, its project templates don't add a Namespace declaration. – Hans Passant Nov 08 '19 at 14:24

1 Answers1

0

Correct answer is indicated by the first comment on question by Hans Passant. The MDI form is in a subfolder within the project and hence needs the path within the Assembly reference.

Mark Roworth
  • 409
  • 2
  • 15