The past few months, I’ve been busied with looking for a new home. Unfortunately, with home buying comes specials, taxes, financing rates, and a myriad of other calculations—the house price means nothing.
For example, if a home was 150,000$ with no specials, chances are the payment would be less than a home that’s 135,000$ with 15 years of specials left (~15,000$, or 1000$ per year), at least until that 15 year period is over.
But, walking through models and with an agent—how can you calculate that right off the bat? My agent has a spiffy little calculator that does it, but can’t figure in Homeowner’s Dues or Specials, just PITI. Well, I’m a developer—I just needed to develop something!
So began my first venture into creating a Windows Mobile 6 application. I’ve had my T-Mobile HTC Wing. It’s not a super fancy “all in one,” but I really like it. What I liked most, when I purchased it, was that I could develop .NET apps for it—I just never (until now) had a good reason.

Lessons Learned:
- The experience of developing for the Mobile platform (e.g. compact framework) is nearly identical to developing for Windows forms—the only difference is being limited to screen size.
- The screen resolution (inspite of what shows up on the emulator) does not mirror how it appears on the PDA—even when using the correct emulator and skin in Visual Studio. This may be a caveat to my Wing, who knows.
Beyond that, at least for this basic application, everything’s the same. Drag your text boxes, labels, and other controls onto the form, then add logic into the events.
Things I Need To Work On:
- Using multi-form “forms”—how can I popup a box for more information?
- How can I add a .config file with the application and read/write to it?
- How can I save information and settings?
- How do I get applications to show up on the Programs menu?
Easy things to research—just haven’t had time.
Also, for those interested, here’s the mortgage forumla based on the Excel PMT formula and rehashed to be used in .NET. This calculates PITI, then adds in specials, homeowner’s dues, etc. based on the term of the loan etc. I’ve bolded the important part. Spacing and usage of the Math.Pow method is required (since C# doesn’t support the ^ operator).
The 20% check mark calculates a downpayment that ensures avoiding mortgage insurance (which is a TOTAL waste of money since it simply ensures the lender, not you). CalculateDownPayment() returns 20% of the entered value.
NOTE: I’m sure I could refactor and get fancy—but for something this simple, there’s not a lot of value. As I add (if I am house shopping THAT long to NEED to) features, I may split things up.
private const int monthsPerYear = 12;
private const int term = 30;
private void Calculate_Click(object sender, EventArgs e)
{
if (PmiCheckbox.Checked)
Down.Text = CalculateDownPayment();
var rate = Convert.ToDouble(Rate.Text);
var monthlyRate = rate / monthsPerYear;
var value = Convert.ToDouble(Value.Text);
var down = Convert.ToDouble(Down.Text);
var taxes = Convert.ToDouble(Taxes.Text);
var insurance = Convert.ToDouble(Insurance.Text);
var principal = value - down;
var principalAndInterest =
(principal * monthlyRate) /
(1 - Math.Pow((monthlyRate + 1),
-(term * monthsPerYear)));
var taxesAndInsurance =
(taxes / monthsPerYear) + (insurance / monthsPerYear);
var subTotal =
principalAndInterest + taxesAndInsurance;
var specials = Convert.ToDouble(Specials.Text);
var homeOwners = Convert.ToDouble(Homeowners.Text);
var additionalCharges =
(specials / monthsPerYear) + (homeOwners / monthsPerYear);
var total =
subTotal + additionalCharges;
Total.Text = string.Format(“T: {0:C}”, total);
}
To conserve real estate, I put the “Total” down near the Calculate button.

The application itself is probably directly out of a CS100 course—basic mathematics, but the fact that it’s on my mobile phone rocks.
To me, getting paid at work to create something is great and fufilling, but having a need, even one as simple as this, and being able to create it from scratch is truly rewarding and reminds me why I love being a developer.