Call Form that is inside a Folder.

ELIRDFUL 185 Reputation points
2023-11-25T15:02:58.52+00:00

Hello everyone, I am starting programming in c Sharp

 

I have a form called: frmRegistroProducto, but it is inside a folder called: Records.

User's image

I have a Second form called: FrmMenu, but it is not inside a folder.
User's image

From the second form: FrmMenu, through a button I try to call or invoke the first form: FrmProducto, but it gives me an error.

User's image

User's image

I count on your help

Developer technologies | C#
{count} votes

2 answers

Sort by: Most helpful
  1. ELIRDFUL 185 Reputation points
    2023-11-25T15:50:33.54+00:00
    Registros.FrmRegistroProducto Producto = new Registros.FrmRegistroProducto();             Producto.ShowDialog();
    

    The problem is solved, just put the name of the folder in front of you.

    0 comments No comments

  2. Anonymous
    2023-11-27T05:45:20.7833333+00:00

    Hi @ELIRDFUL , Welcome to Microsoft Q&A,

    That's a namespace problem.

    When you put it inside a folder, it can't get the target file. They must be in a namespace to be used directly.

    I created a demo example:

    User's image

    You can see that Form2 is in Demo.Test and Form1 is in Demo.

    User's image

    User's image

    You can either use Test.Form2 directly or add using Demo.Test to it.

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.