Hi all, i have added the form required in my project. it is showing there in solution explorer window. But i cant access that form through coding. can anyone tell me wt is the problem

Dani AI

Generated

A few of the replies here point toward file/namespace issues; the checklist below covers the other, commonly missed causes and quick fixes that actually solve the problem more often than not. Thanks to , , and for highlighting the likely areas — the items below extend that advice with concrete checks.

Files and project settings to verify:

  • Confirm all three form files are present in the project: the .cs (code), the .Designer.cs and the .resx. In Properties, the .cs and .Designer.cs Build Action must be Compile; the .resx should be EmbeddedResource (and use ResXFileCodeGenerator if a custom tool is expected).

  • Make the form class accessible across projects by declaring it public. Example:

    public partial class MyForm : Form
    {
        public MyForm()
        {
            InitializeComponent();
        }
    }
  • If the form lives in a different project, add a project reference (Solution Explorer -> target project -> References -> Add Reference -> Projects). After adding the reference you can either add a using for the namespace or instantiate with the fully qualified name.

  • If you used "Add Existing Item" -> "Add as Link", be aware the designer and resource lookups can break. Copy the three files into the consuming project instead, or keep the form in one project and reference that project.

Quick troubleshooting steps:

  • Clean and rebuild the solution. Check the Error List for the exact compiler error (that message is usually the most useful hint).
  • Verify both projects target compatible frameworks/version.
  • Look for duplicate class names or the class being nested inside another type.

If the issue persists, include the exact compiler/runtime error and the form’s class header (namespace and the public partial class line) — that allows a precise diagnosis.

Recommended Answers

All 4 Replies

Probably you've added just the .resx file!! and didn't form code file.

if u want to add existing file means. right click the solution exp and add- existing file- choose only enough.it wil add to sol exp. then u can create object for that form in form1 - buton click event

Hi,

Make sure that your From has the same namespace as the class from where you want to cosume it.

Regards,
Camilo

Having different namespaces doesn't matter. Just while referencing to the form that you added, provide the full qualified path. Include the whole namespace path till your reach your desired Form Class. That should do the trick.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.