Geeks With Blogs

David Madden Mastering the craft one mountain at a time. April 2013 Entries
Why the custom comparer is your friend
I have a ListView that is holding session dates for sessions someone may attend. I like to use a MonthCalendar control to allow the user to select several dates, allowing the control's DateSelected event to add an entry to the ListView control as a formatted date string for readability. Sorting is not nice though using the plain sort orders.So I implemented an nice solution. I added a custom comparer to sort those string dates in the ListView control. Just add the following to your form's namespace, ......

Posted On Tuesday, April 30, 2013 4:29 PM

Casting it old school
If you have to display a two numbers and a percentage from older T-SQL you can do the following.cast((((cast((que... as decimal) / cast((query1) as decimal)) * 100)) as decimal(5,1)) as 'Percentage'This will yield you a nice percentage like 67.9. All the casting is to preserve the numbers as decimals and not be boxed to integers. Note: Each query should return a count of something where query 2 is a quantity that is lesser than query1. Such as query2 being the total who like dessert and query 1 ......

Posted On Tuesday, April 23, 2013 1:26 PM

Crystal Reports - Getting the number under control
I do not deal many Crystal Reports but recently have had to dive into a few. One of the things that drive me nuts is dealing with numbers such as in the running totals. To get a number to display correctly you need to use the ToText function. A good site I found is this. To get the variable myNumber = 2.3798554 to display as 2.4 you would do the following: ToText(myNumber,2) I know this is not very exciting stuff but if you do not deal with things like this often, it can be a real pain ......

Posted On Tuesday, April 23, 2013 11:19 AM

Copyright © DavidMadden | Powered by: