Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculated fields using mmMaskedTextBox
Message
From
05/06/2006 02:10:45
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Calculated fields using mmMaskedTextBox
Miscellaneous
Thread ID:
01127035
Message ID:
01127035
Views:
77
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!
Next
Reply
Map
View

Click here to load this message in the networking platform