Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Databinding Issue
Message
De
19/11/2010 13:09:35
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Databinding Issue
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01489807
Message ID:
01489807
Vues:
100
This is a WinForm App using strongly typed datasets

When this code executes, the textboxes associated with the updated columns refresh immediately on the form
// Populate the ship-to if indicated
            soInformation.somastds.soaddr[0].company = soInformation.somastds.somast[0].fname.TrimEnd() +
            " " + soInformation.somastds.somast[0].lname.TrimEnd();
            soInformation.somastds.soaddr[0].address1 = soInformation.somastds.somast[0].address.TrimEnd();
            soInformation.somastds.soaddr[0].city = soInformation.somastds.somast[0].city.TrimEnd();
            soInformation.somastds.soaddr[0].state = soInformation.somastds.somast[0].state.TrimEnd();
            soInformation.somastds.soaddr[0].zip = soInformation.somastds.somast[0].zip.TrimEnd();
In the code below, before I added the code at the bottom that cleared and reset the bindings, the associated textboxes would not refresh.

The only difference I can see is the data in the first case is coming from a datatble, while in the second case it's coming from properties in an object.

I know the original binding worked because the textboxes showed the correct values. When the values changed, however, nothing happened.

Am I missing something?

Is there an easier way to refresh bindings?
I browsed the web and found some old tools that no longer work.
 if (soInformation.somastds.soline[0].pwidft != 0 &&
         soInformation.somastds.soline[0].plenft != 0)
     {
       feetandinches Overlaplength =  soInformation.GetOverlapValue(soInformation.somastds.soline[0].overlapid);
       feetandinches coverwidth =   CalculateFeetandInches(soInformation.somastds.soline[0].pwidft,
       soInformation.somastds.soline[0].pwidin, Overlaplength.Feet, Overlaplength.Inches);
       soInformation.somastds.soline[0].cwidft = coverwidth.Feet;
       soInformation.somastds.soline[0].cwidin = coverwidth.Inches;
       feetandinches coverlength = CalculateFeetandInches(soInformation.somastds.soline[0].plenft,
       soInformation.somastds.soline[0].plenin, Overlaplength.Feet, Overlaplength.Inches);
       soInformation.somastds.soline[0].clenft = coverlength.Feet;
       soInformation.somastds.soline[0].clenin = coverlength.Inches;
     }
     textBoxCwidft.DataBindings.Clear();
     textBoxCwidin.DataBindings.Clear();
     textBoxClenft.DataBindings.Clear();
     textBoxClenin.DataBindings.Clear();
     textBoxCwidft.DataBindings.Add("Text", soInformation.somastds.soline, "cwidft");
     textBoxCwidin.DataBindings.Add("Text", soInformation.somastds.soline, "cwidin");
     textBoxClenft.DataBindings.Add("Text", soInformation.somastds.soline, "clenft");
     textBoxClenin.DataBindings.Add("Text", soInformation.somastds.soline, "clenin");
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform