471,337 Members | 802 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

actulizar un textbox desde otro formulario

hola amigos.... tengo dos formularios en los cuales desde uno de ellos quiero
poder modificar lo que lleva dentro un textbox el otro.

agradesco su colaboracion.

Marcelo
Jun 13 '07 #1
1 7790
On Jun 13, 8:58 am, Marcelo <Marc...@discussions.microsoft.comwrote:
hola amigos.... tengo dos formularios en los cuales desde uno de ellos quiero
poder modificar lo que lleva dentro un textbox el otro.

agradesco su colaboracion.
Seria mejor hacer esta pregunta en microsoft.public.es.dotnet.vb.

Pero, tambien ofresco servicio de traducion, gratis. :-)

The post reads:

"Hello. I have two forms, and I want to change the contents of a text
box on one form from another. Thank you for your help."

Here is a solution.

Let's call your forms form1 and form2. Say that form1 conteains
textBox1, and you want to change textBox1 from form2.

First, form2 needs a reference to form1. If form2 is going to change
something on form1, then it has to be able to get to form1. How you do
this depends very much on how the two forms are created. You would
have to give more details in order for us to provide help there.

Second, form1 should define a property that allows outsiders to modify
the contents of the text box. It is best to name the property after
what the information in the text box is, not after the text box
itself. Something like this:

public string NombreDeCliente
{
get { return this._textBox1.Text; }
set
{
if (value == null)
{
this._textBox1.Text = "";
}
else
{
this._textBox1.Text = value;
}
}
}

Then, from form2, you can do this:

form1.NombreDeCliente = "John Smith";

Jun 13 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Gema | last post: by
reply views Thread by Jonas L | last post: by
11 posts views Thread by Liber | last post: by
4 posts views Thread by =?Utf-8?B?S3VsYmVy?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.