Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bound controls
Message
De
09/07/2004 19:30:03
 
 
À
07/07/2004 17:35:51
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Divers
Thread ID:
00921632
Message ID:
00922853
Vues:
14
Bonnie,
I'm on a different form, and I can't get a property bound to a textBox. I'm losing my marbles! :)

label2 shows "Yowza!!!" when I run the program, so the binding is working to some degree. But when button2_Click() changes the form property, the textBox does not update.

Can you take a quick look?
private string _formHeight;

public string FormHeight
{
   get { return _formHeight; }
   set { _formHeight = value; }
}

public Form1()
{
   InitializeComponent();
   this.FormHeight = "Yowza!!!";
   label2.DataBindings.Add( new Binding("Text", 
            		this, "FormHeight"));
		
}

private void button2_Click(object sender, System.EventArgs e)
{
   this.FormHeight = "what you gonna do?";
   MessageBox.Show(this.FormHeight);    // shows "what you gonna do?"
}
>Yep, you can bind to a property ... but make sure it's a public *property* (with a get/set) and not simply a field (public or otherwise).
>
>MyTextBox.DataBindings.Add("Text", this, "MyProperty");
>
>
>~~Bonnie
>
>
Steve Gibson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform