I have the following problem I am trying to concatenate a variable that I get from one form to show it in another, I do it in the following way.
1.Formular
ClsIntermedia objLibreria = new ClsIntermedia();
if (objLibreria.Validar_Usuario(this.txtusuario.Text, this.txtcontrasena.Password.ToString(), out respuesta, out respuesta2))
{
Principal ventana = new Principal();
ventana.usuarioini = respuesta;
MessageBox.Show("BIENVENIDO: " +respuesta+ " "+"DE: " +respuesta2+"", "SICAP, Agrosan S.A.S", MessageBoxButton.OK, MessageBoxImage.Information);
ventana.Show();
this.Hide();
}
else
{
MessageBox.Show(objLibreria.Error, "Error del sistema", MessageBoxButton.OK, MessageBoxImage.Error);
objLibreria = null;
this.txtusuario.Text = "";
this.txtcontrasena.Password = "";
this.txtusuario.Focus();
}
Where the variable userini I have it published in the second form, I get the data I assign it and when I concatenate it in the second form, it does not show me the data.
2. Form
public string usuarioini ="";
public Principal()
{
InitializeComponent();
this.Title = Modelo.Util.Mensajes.MsjInicio + " " + "USUARIO: " + usuarioini + " " + "VERSIÓN: " + ConfigurationManager.AppSettings.Get("version");
}
I do not know if it has anything to do, the fact that when the second form is launched, it loads the values that the constructor has, and since the variable takes the value, and the second form is already loaded, I do not know if it is that's why he can not carry it.
Thank you in advance for your comments.