Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird CheckBox and TabPage Behavior
Message
De
07/10/2010 09:03:31
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Weird CheckBox and TabPage Behavior
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01484316
Message ID:
01484316
Vues:
88
Here's a weird problem:
I hope I can explain it clearly.

I have a Win Form with a tab control with 5 pages
All controls on all pages are bound to one SQL Server table with a lot of columns.
All seems well with the data handling. All columns are updated properly, and appear properly on the tab pages when the record is selected -

EXCEPT:

If I select a tab page with a checkbox on it, when I exit the paget. I have to exit the form in order to select another record and see the data on the form.

If I select a tab page without a checkbox and exit the page I can select another record and see the data on the form without having to leave the form.
It seems that exiting a page containing a checkbox is messing up the bindings. In the bebugger, the binding seems to be gone.

I validated this by moving a checkbox on and off a page and got failure and success.

I thought something might be wrong with a particular checkbox so I tried it with several and got the same results.

All the data for the checkboxes shows perfectly and updates perfectly.


Here's how I set the bindings
  public void SetBindings()
    {
   
      foreach (Control c in tabControlCustomer.Controls)
      {
        foreach (Control d in c.Controls)
        {
          if (d is TextBox)
          {
            int length = d.Name.ToString().Length;
            string columnname = d.Name.ToString().Substring(7, length - 7);
            d.DataBindings.Add(new Binding("Text", customerAccess.ds, "arcust." + columnname));
            continue;
          }
          if (d is CheckBox)
          {
            int length = d.Name.ToString().Length;
            string columnname = d.Name.ToString().Substring(8, length - 8);
            d.DataBindings.Add(new Binding("Checked", customerAccess.ds, "arcust." + columnname));
            continue;
          }
        }
      }
    }
Any clues??????????????????
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