How I can take a string from a txtbox which is autocompleted and then send it to another form?
The value I need to send is txtClient.Text = (value != null) ? value.Desc : string.Empty;
private List<String> _clienteString;
private Marcas _clienteSeleccionado;
public delegate void ClienteSeleccionadoHandler(object sender, EventArgs e);
public event ClienteSeleccionadoHandler CambioClienteSeleccionado;
public UCBusqCliente()
{
InitializeComponent();
}
public Marcas Cliente
{
get
{
if (!string.IsNullOrEmpty(txtCliente.Text.Trim()))
_clienteSeleccionado = Cache.Clientes().Where(c => c.Desc.Equals(txtCliente.Text)).FirstOrDefault();
else _clienteSeleccionado = null;
return _clienteSeleccionado;
}
set
{
_clienteSeleccionado = value;
txtCliente.Text = (value != null) ? value.Desc : string.Empty;
}
}
#endregion
private void UCBusqCliente_Load(object sender, EventArgs e)
{
if (!DesignMode)
{
_clienteString = (from c in Cache.Clientes() select c.Desc).ToList();
txtCliente.AutoCompleteList = _clienteString;
}
}
I have tried to read the txtbox as a string but I get an empty value: string value = txtClient.Customer.ToString();