Wednesday, March 21, 2007

Why MaskedTextBox is Bad

In Visual Studio 2005 Microsoft included a Mask control called MaskedTextBox. This control acted like a text box control, but allowed at design time or runtime the ability to add a mask to help the user input proper data.

This conception this is a great idea. The implementation however is not very good. There are a few problems.

The control does not know how to shift characters. An example would be if the mask was $##,###.00 and we had the amount of 100 saved in the data base and we tried to fill the control with that amount the result displayed would be $10,0__.__ where _ is the prompt character. The same problem occurs when the user tried to enter the data. Lets use a format for time like ##:##. When the form loads, the control will look something like this __:__ again using _ as the prompt character. the cursor will be on the left most space so if a user is not careful, the time of 9:30 can be enter like 93:0_. If the user corrects the mistake and saves the value 9:30 the control will load 09:30.

Since most of things that require mask are numbers and things of that nature, it makes this control pretty mush useless.

I found a few posts on the web that discuss this problem and how they solved it.
http://www.adduxis.com/blogs/blogs/sven/archive/2006/06/21/18.aspx
http://www.dotnetheaven.com/Uploadfile/mgold/MaskedCurrencyTextBox02252006005553AM/MaskedCurrencyTextBox.aspx

Monday, March 19, 2007

Jury Duty

Last week I served jury duty. I never have been called for jury duty before and I really didn't want to go.

So how it works is all the people chosen for duty show up at a predefined time and are checked into the system. I think there were about 150 people or so. Then we are shown a video that talks about the importance of jury duty and some rules of being on a jury.

After that you sit in a room waiting to hear your name called. The process is completely random. A computer picks names of people there and they are the ones assigned to a court room once it is determined a jury is needed. There is no guarantee you will even see the inside of a courtroom due to last minute plea bargains and what not. So I was lucky I only had to sit there for about 30 minutes before my name was called.

Once we were brought to the court room the judge gave us some information about the case and he then asked all 25 potential jurors some basic questions. Things like name, married or single, do you have kids, and where do you work. He then asked us if we knew any of the lawyers, or the defendant or plaintiff, or if we were involved in anyway with any part of the court case.

Then the plaintiff's lawyer asked us questions followed by the defendants lawyer. All the questions were to the entire group. Things like Have you ever filed a personal injury lawsuit, or have you ever worked for a law firm, that sort of thing.

Once this was completed somehow the two lawyers dwindled the 25 possible jurors down to twelve. I was one of the lucky 12.

Once the trial proceeded we were told by the judge some more details of the case and what is evidence and what was not evidence. We were not told however any laws or what we would be ruling on specifically. Also us jurors were not able to talk to each other about the case until we deliberated. We were told we would be determining damages but that was it. So far it was nothing like I had seen on TV or in the movies.

So once the judge was done we heard opening arguments of both sides. This is when the plaintiff sets up their case and explains why they are suing. In this case they were saying that a simple accident to a 90 year old women 2 years ago started a downward spiral of her health. Then the defense attorney explained why the defendant should only be liable for the accident and not the new ailments not caused by the accident.

Then we got to listen to the testimony(evidence) in the case. In this case we had three people in the court, and we had three other people with taped dispositions. It was actually a little boring since this case had very few facts and a lot of guesses. Because there were so few fact wrapped up in educated guesses this case was not very black and white.

Once both sides were done showing evidence, the judge then told us what we would be deliberating on. What laws pertained to this case and what damages we need to figure out. Then both sides gave closing arguments, and we were sent to deliberate. The first thing we were told is not to talk about the case when jurors were not present. Also we were told not to leave the juror's room for any reason other than bathroom. Food and beverages were sent to us. Also all the exhibits in the case were in the room.

Then the jury elects a leader and that person gets things rolling. It took us about two and a half hours to deliberate. We all agreed right away that the accident did not cause the additional health problems, but we had to figure out what damages were appropriate for the initial accident. We finally all agreed to use some simple formulas to determine damages.

In the end I am glad I served on a case. I learned a lot about the judicial process. Plus I think sitting in the room all day would have driven me insane.