Category Archives: 13569

VB Quark #7 : Optional Parameters and Dates

Hopefully you already know VB has full support for Optional parameters, both declaring them and calling them, but did you know you can use Dates as Optional parameters ?    Public Sub AddNewCustomer(customer As Customer,                               Optional dateAdded As Date = Nothing)       … Continue reading

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

Displaying Dates in VS 2010

From time to time there’s discussion about the way dates are displayed in the Visual Studio IDE for Visual Basic. Typically dates are shown using VB’s date literal syntax of #MM/dd/yyyy# which is the standard US format.  For people outside … Continue reading

Posted in 13569, 491, 5162, 5726, 7099, 7341, 8582, 8917 | Leave a comment

VB Quark #6: Date operators

The DateTime structure in .NET includes custom operators for Date comparisons such as less than, greater than, equal and not equal; but did you know it also includes addition and subtraction operators ?  There’s two subtraction operators and one addition … Continue reading

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

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 Windows Phone Toolkit Aug 11 sample

The Silverlight Windows Phone Toolkit August 2011 (7.1 SDK) doesn’t contain a working VB sample.  If you try to load the VB sample that does ship, you’ll get hundreds of errors.  So I put together the VB sample that should … Continue reading

Posted in 13569, 15036, 491, 5162, 5726, 7099, 7187, 7341, 8917 | Leave a comment

Remember variant ?

Cory is continuing his posts about VB10 differences from VB6. His latest posts is on variants. Variants were/are basically a structure that contains a variant type enumeration and either the variable’s data value or a pointer to the variable data. … Continue reading

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