Monthly Archives: September 2011

VB Quark #5: C is for Char

Can you pick the problem with this code ? :       Dim currentChar As Char       For i = 0 To largenumber          currentChar = getChar(i)          If currentChar = "a" Then             count += 1          End If       Next   The … Continue reading

Posted in 13569, 16311, 491, 5162, 5726, 7341 | Leave a comment

VB Quark #4: type literals

Do you know why you can’t write this code in VB:    Dim x = 123456789.0123456789 Answer: The IDE won’t let you If you try to write that code the IDE will truncate the number, giving :    Dim x … Continue reading

Posted in 13569, 16311, 491, 5162, 5726, 7341 | Leave a comment

VB Quark #3: operator differences in VB/C#

Can you spot the problem with this code:    <Extension()>    Public Function ToColor(argb As UInteger) As Color       Return Color.FromArgb( _                       CType((argb & &HFF000000) >> &H18, Byte), _                       CType((argb & &HFF0000) >> &H10, Byte), _                       CType((argb & &HFF00) >> 8, … Continue reading

Posted in 13569, 15036, 16311, 491, 5162, 5726, 6184, 7187, 7341 | 1 Comment

VB Quark #2: compiler directives and constants

Building upon VB Quark #1 , did you know you can use compiler directives alongside expressions in constants ? #If CONFIG = "Debug" Then    Const path As String = "Z:\mydebug.sdf" #Else    Const path As String = "|DataDirectory|\Database1.sdf" #End If    Const … Continue reading

Posted in 13569, 16311, 491, 5162, 5726, 7341 | Leave a comment

VB Quark #1: constant expressions

This quark is more of a did ya know quark about constant expressions in VB. You probably know you can declare a constant expression such :    Const appName As String = "My Really Cool App" But did you know you … Continue reading

Posted in 13569, 16311, 491, 5162, 5726, 7341 | Leave a comment

VB Quark #0 : lambda expressions and statements

This VB Quark is the one that started the conversation some weeks back. It’s number 0, both because these days things are typically 0 based in .NET, and also you could say it is ground zero. It’s about a quirk … Continue reading

Posted in 16311, 491, 5162, 5726, 7341 | 1 Comment

VB Quarks …

A few weeks ago I was having a discussion about a particular language feature that was causing a couple of people to trip up in their code. From that discussion we identified some places where the VB compiler and IDE … Continue reading

Posted in 16311, 491, 5162, 5726, 7341 | Leave a comment

Windows Phone Mango and multiple google calendars

With Windows Phone 7.5 (aka Mango) being released in the next couple of weeks, you may have to work around a google limitation to get multiple google calendars on your device. Both Windows Phone 7.5 and google calendar allow you … Continue reading

Posted in 15036, 15128 | 7 Comments