Tuesday, October 19, 2010

VBScript Properties

I've been spending a lot (make that a LOT) of time in VBScript lately. I needed to reproduce some properties that I regularly use in .NET, and I wasn't sure I'd be able to do it. After discovering that it's actually NOT as hard as I expected, I thought I'd post the template out here:

Class myClass
        Private ldteTime()

        Public Property Let Time(intIteration, dteValue)
                On Error Resume Next
                Dim i
                i = UBound(ldteTime)
                If (Err.Number = 0) and (i > -1) Then
                        If intIteration > i Then
                                i = UBound(ldteTime) + 1
                                ReDim Preserve ldteTime(i)
                        End If
                Else
                        i = 0
                        ReDim ldteTime(i)
                End If
                ldteTime(i) = cDate(dteValue)
        End Property
        Public Property Get Time(intIteration)
                Dim i
                i = 0
                If intIteration <= UBound(ldteTime) Then
                        i = intIteration
                Else
                        i = UBound(ldteTime)
                End If
                Time = cDate(ldteTime(i))
        End Property
        Public Property Let LastTime(dteValue)
                Dim i
                i = UBound(ldteTime)
                ldteTime(i) = cDate(dteValue)
        End Property
        Public Property Get LastTime
                Dim i
                i = UBound(ldteTime)
                LastTime = ldteTime(i)
        End Property
End Class

Monday, September 6, 2010

One user control at a time!

Got the itch today and started researching Silverlight... which of course--being a developer--meant opening Visual Studio 2010 and jumping right in to poke around. Sadly, that didn't get me very far on my own.

I started searching around for a simple HOW TO on new Silverlight projects and found one by Kunal Chowdhury on .net Funda. It's part two of his Silverlight series. This article was more my speed for startup:

  1. Open a new project

  2. Do "Hello World" a couple different ways

    1. Through a design-time text control

    2. Through a run-time code block

  3. Create additional page material (static in this case) and OOP-it around the project


More importantly (to me) I learned a few things on my own:

  1. How to stop the web instance/port when the application is no longer viable and I can't get it to unload through VS

  2. F5 to Run With Debugging, Shift-F5 to Stop Debugging (but not the server instance), and Terminate All will close your entire browser (even if you're blogging on another tab) but still not stop the server instance!

  3. Intellisense error help means absolutely nothing when working with the LayoutRoot (display Grid) node

  4. That adding a design-time text control with data and then adding an additional run-time text code block to the same LayoutRoot (display Grid) node will cause EITHER an error (see the Intellisense gripe above) or an eternal loading loop on the browser