How can I initialize an empty string whose value is "" but in this line of code:
Presenter.OnRazonSocialChanged(txtRazonSocial.Text);
I had solved it in the Presenter's constructor in the following way:
public ProveedorPresenter(Proveedor model, ProveedorView view)
{
_model = model;
_view = view;
_model.RazonSocial = "";
_model.DocumentoIdentidad = "";
_model.Direccion = "";
_model.Fijo = "";
_model.Celular = "";
_model.Representante = "";
_model.Email = "";
_view.Presenter = this;
}
Without initializing the variables as empty, I get the following error:
As you will see from the TextChanged event, what would be the solution?
Thanks to everyone for answering, I promise to improve the quality of my questions and devote more time to elaborate them. Thanks to all of you, I managed to solve it in this way.
Create a method in the Presenter called Initialize model
public void InicializarNodelo()
{
_model.RazonSocial = string.Empty;
_model.DocumentoIdentidad = string.Empty;
_model.Direccion = string.Empty;
_model.Fijo = string.Empty;
_model.Celular = string.Empty;
_model.Representante = string.Empty;
_model.Email = string.Empty;
}
And I call it in the load of my Vista (form)
private void ProveedorView_Load(object sender, EventArgs e)
{
Presenter.InicializarNodelo();
}