Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

PocketBalance Application

0.00/5 (No votes)
8 Jun 2004 1  
A bank balance prediction utility for the Pocket PC.

PocketBalance

Introduction

PocketBalance is a bank balance forecasting utility. I wanted something that could tell me what my account balances would be next month, without having to put in much effort to keep it up to date.

I’d tried a few commercial money packages some years back, but my bank was a bit backward and it was a pain to integrate the two. I had to manually enter stuff and regularly reconcile things to keep it happy. In the end it was too much bother, and I had more success crawling out of debt with a simple Excel worksheet :o)

All that’s needed to keep PocketBalance happy is a list of recurring transactions (utility bills, salary etc) and an occasional snapshot of the current balance. It can:

  • Manage multiple accounts (checking/current, savings, credit)
  • Automatically apply recurring transactions (daily, monthly, fortnightly, annually etc)
  • Automatically apply regular credit card payments (for both “pay in full” and “minimum percentage” terms, based on a previous statement balance)
  • Show a balance graph you can click on to locate transactions

Of course you can throw in a whole load more detail for PocketBalance to play with if you like. The more detail it has, the more accurate its balance prediction will be.

Background / Implementation

I’d not even attempted to write a PocketPC application before. I’d done plenty with ASP.NET, loads of class libraries and some Windows Forms, but was a definite newbie here.

I knew I wanted DataSets, and wanted to get the Framework to do all the hard work for me. My plan was to throw together a nice typed dataset, bind it to a few things, add a few buttons and some calculations and I’d be done. Cake ;o)

I spent the next few evenings (real job during the day + 3 kids = little time to play) cursing Microsoft for not giving me typed datasets, XML serialization or a decent sized screen. Everything I wanted to use seemed to be missing :o( Rarely a quitter, I picked them off bit at a time:

  • I drew up a schema for the data I wanted in VS.Net’s XSD designer. Overcome with giddy anticipation I gave it primary keys and relations. Victory beckoned.
  • The basics of the DataSet were there, so I just loaded the XSD in (with ReadXmlSchema) and my tables were defined and looking very pleased with themselves. I roared with delight.
  • I decided the screen was actually quite big if you were close to it. I’d just have to make every pixel count :o)

I created some dummy data and put it in as an embedded resource (SampleData.xml). Until I got it loading and saving stuff, it could play with this.

After that it’s a bit of a blur. I went down a couple of wrong roads and reversed best I could. I realized I didn’t know half as much as I thought I did about databinding in Windows Forms. There was a whole world of BindingContexts and things I’d never tried, so if nothing else it was good practice.

Points of Interest

Some of the nasties I battled on the way were:

  • The Windows Forms controls just wrap the regular Windows CE controls, but don’t let you override very much. I wanted nice listboxes and a graph but the inbuilt controls couldn’t cut the mustard :o( I soon found it’s very easy to create new controls (probably easier than messing with the inbuilt ones) so put together a quick 2D graph viewer control (see the PocketGraph assembly).
  • I wrestled with the inbuilt ListView control to display the transactions, but it beat me. It painted each row in a half-assed way, and didn’t support databinding :o( I hated it so much I wrote my own (DetailView in the PocketControls assembly). It wasn’t a complete replacement, but it did everything I needed.
  • Creating forms seemed painfully slow. I put in some over-elaborate code to create them only once and it became bearable (taking some ideas from MSDN’s FormStack example).
  • I wanted to use GUIDs as the row identifiers in my DataSet (to save me having to worry about uniqueness), but the PocketPC didn’t know how to make them :o( Fortunately MSDN came to the rescue with this article (posted on CodeProject), which became a new ‘PocketGuid’ assembly.
  • Sizing and positioning controls in the VS.Net designer can be fiddly, and the inbuilt ones seem inconsistent in having borders you can’t switch off etc. Creating custom controls is well worth the effort because you get the choice to forget borders if you like, and you can also implement double-buffering for flicker-free operation…

Eventually I got it doing everything I wanted (I’m sure there are a billion bugs) and set about writing an installer for it. This would have been headache-inducing (it’s not as slick as creating a regular setup project) if not for a guy called Simon Kittle who put together this very useful article.

It’s certainly not a “best practice” implementation. I’ve kept it reasonably simple, but there are places it’s a bit inconsistent (it’s largely using data binding, but there are a couple of examples of manually initialized stuff). Nothing hugely wrong with it though - I’ll just regard it as a learning exercise ;o)

Since starting this I’ve realized developing PocketPC applications is pretty satisfying. Some of the uglier moments are like having teeth pulled by enema, but once you accept the constraints it [mostly] falls nicely into place. I’ve already decided what my next PPC project will be… If it turns out OK, I’ll post it here :o)

Some screenshots

History

None yet, but lots to come!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here