Get a form variable and pull in the other form

-1

Good evening,  I'm breaking my head on how to get the value of a form and store it in a variable so I can access that value in any other form.

I tried already as the public static instantiating but I did not get success the return null value.

Thanks for any help.

    
asked by anonymous 24.07.2018 / 01:43

1 answer

0

Good morning Carlos.

Although this is not a good practice, you can create a static class that stores the values you need.

public static class RepVariaveis
{
    public static string MeuValor { get; set; }
}

So, in the first form, you just assign the value to the class RepVariables.

RepVariaveis.MeuValor = "xxxx";

However, this type of practice is not good because in a scenario with a large number of forms, it can become complicated to generate

    
24.07.2018 / 14:31