In my application you will have a Login system. I want to create a variable to store the id of the user that is logged in, and that it can be accessed on all other forms.
I need this because in my database, each table has a field called usuario
that will store the name of the user who saved the record in the database.
Whenever I want to use the variable in another form, I do so:
form meuLogin = new form();
meuLogin.idUsuario = tabela.id;
So I always create a new object of formLogin
(which is where the variable idUsuario
is stored) to be able to get the variable. Am I doing right or have a way to make a "global" variable?