Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculated fields using mmMaskedTextBox
Message
De
05/06/2006 02:10:45
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Calculated fields using mmMaskedTextBox
Divers
Thread ID:
01127035
Message ID:
01127035
Vues:
80
I'm building a mmMantenanceForm where length values are stored in the database as millimeters, but the UI can display either Imperial and Metric, depending on the project.

Is there a way to create a "dual" value mmMaskedTextBox? I'm having some arcthitecture problems.

AutoSetEnabled = false or true, tried both
BindingFlag = false
BindingSource = [none]
BindingSourceMember = [none]

1) Where do I do the data bind?
I've tried "piggy-backing" on another field's BindData event, but that doesn't always fire when navigated...(?)
On the first navigation event, it asks "Save changes?" and then the value never changes.
The field is also disabled/read-only(!)
private void txtOtherField_BindData(ImmBinding control, mmBindDataEventArgs e)
{
    // "piggyback" on this event to bind length fields
    DataRowView dv = this.GetCurrentRow(oMyObject);

    if (oMyObject.MeasurementSystem == MeasurementSystem.Imperial)
    {
        Length len = new Length((int)dv.Row["Length"]);
        txtFeet.Text = len.FootPart();
        txtInches.Text = len.InchPart();
    }
    else
    {
        txtFeet.Text = dv.Row["Length"].ToString();
    }
}
2) Where do I the presave conversion?

Do I need to create a dataview with an extra column for each alternately displayed field, updating the column in the business object navigated event, saving calculation in the presave event?
Do I need to use a non mm MaskedTextBox?
Or... ?

Thanks!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform