Browse Blog Posts by Tags

Showing related tags and posts for the Blogs application. See all tags in the site
  • Why a little bit of VB is a bad bad thing

    Scott Hanselman posted about VB6 and showed a snippet of code : Public Function Fib(ByVal n As Integer) As Integer Fib = IIf (n < 2, n, Fib(n-1) + Fib(n-2)) End Function What Scott probably didn’t realize that the IIF function in VB (both VB6 and later) is a Function not an operator. That means...
    Posted to @ Head by bill on Mon, Jun 11 2012
    Filed under: Filed under: , , ,
  • 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 ,                              ...
    Posted to @ Head by bill on Tue, Nov 8 2011
    Filed under: Filed under: , , , , , , ,
  • 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 operator defined inside DateTime: date =...
    Posted to @ Head by bill on Wed, Oct 26 2011
    Filed under: Filed under: , , , , ,
  • 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 ...
    Posted to @ Head by bill on Thu, Sep 29 2011
    Filed under: Filed under: , , , , ,
  • 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 = 123456789.01234567 To include all the decimal places you need to be using the Decimal...
    Posted to @ Head by bill on Mon, Sep 26 2011
    Filed under: Filed under: , , , , ,
  • 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( _                      ...
    Posted to @ Head by bill on Sun, Sep 25 2011
    Filed under: Filed under: , , , , , , , ,
  • 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"...
    Posted to @ Head by bill on Fri, Sep 23 2011
    Filed under: Filed under: , , , , ,
  • 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 can also do operations in constants ? Rather than calculate the...
    Posted to @ Head by bill on Fri, Sep 23 2011
    Filed under: Filed under: , , , , ,
  • 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 quark to do with lambda functions versus lambda subs. Let’s say you have a Customer class that...
    Posted to @ Head by bill on Thu, Sep 22 2011
    Filed under: Filed under: , , , ,
  • 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 can possibly help in the future; but for today there are some language features that...
    Posted to @ Head by bill on Thu, Sep 22 2011
    Filed under: Filed under: , , , ,
Page 1 of 1 (10 items)