You are trying to instantiate a class that does not exist, so the compiler will indicate that it does not exist (obviously). When you try to invoke the new Formulario, he will search for the class Formulario, which for the time being does not exist.
If you’re trying to instantiate the Form who is in Formulario, assign an instance to the property value. (Example of this at the end)
If you want your UserForm call another Form, remove the new when attempting to instantiate an instantiated object.
public partial class campos_busca : UserControl
{
public Form Formulario
{
get; set;
}
public campos_busca()
{
InitializeComponent();
}
private void Campos_busca_Load(object sender, EventArgs e)
{
}
private void TextBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{
// Formulario f = new Formulario(); < ~~ você está tentando instanciar a propriedade Formulario
Formulario.ShowDialog(); // < ~~ está a chamar o ShowDialog de sua propriedade Formulario
}
}
And to specify that you will call a particular form, associate it in your property:
campos_busca cbusca = new campos_busca();
cbusca.Formulario = new Frm_produtos();
When calling the event MouseDoubleClick within the cbusca, will call the ShowDialog of Frm_produtos instantiated.
The "Form" field is variable, e.g.: Define "Form Form = Frm_products" When the Doubleclick event triggers it would be like: Frm_products f = new Frm_products(); f. Showdialog(); When to set "Form Formulario = Frm_employee": Frm_employee f = new Frm_employee(); f. Showdialog();
– Marcos ACR