Indicating Infinite Progress, or lack thereof


posted this sample

 of a progress bar that does not
to GDN at some point in the past and I had occasion to use it
today. Using irrational coder logic, I decided that converting it to VB, so I
could place it directly in my application, was faster than modifying his sample
into a component…

Anyway, explanations aside; here is the
code in VB

Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D

Public Class InfiniteProgress
    Inherits System.Windows.Forms.Control
    Dim WithEvents tmr As Timer
    Dim m_Color1 As Color = Color.White
    Dim m_Color2 As Color = Color.Blue
    Dim m_Increment As Integer = 5

    <ComponentModel.Category("Appearance")> _
    Public Property Color1() As Color
            Return m_Color1
        End Get
        Set(ByVal Value As Color)
            m_Color1 = Value
        End Set
    End Property

    <ComponentModel.Category("Appearance")> _
    Public Property Color2() As Color
            Return m_Color2
        End Get
        Set(ByVal Value As Color)
            m_Color2 = Value
        End Set
    End Property

    <ComponentModel.Category("Appearance")> _
    Public Property Increment() As Integer
            Return m_Increment
        End Get
        Set(ByVal Value As Integer)
            m_Increment = Value
        End Set
    End Property

    Dim Position As Single = 0

    Public Sub New()
        Me.SetStyle(ControlStyles.DoubleBuffer, True)

    End Sub

    Protected Overrides Sub OnPaint( _
            ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim b As New LinearGradientBrush( _
            Me.Bounds, Me.Color1, Me.Color2, _
        b.WrapMode = Drawing.Drawing2D.WrapMode.TileFlipX
        b.TranslateTransform(Position, 0, MatrixOrder.Append)
        e.Graphics.FillRectangle(b, 0, 0, Me.Width, Me.Height)
    End Sub

    Private Sub tmr_Tick(ByVal sender As Object, _
            ByVal e As System.EventArgs) Handles tmr.Tick
        Position += m_Increment
        If Position > Me.Width Then
            Position = -Me.Width
        End If
    End Sub

    Protected Overrides Sub _
            OnVisibleChanged(ByVal e As System.EventArgs)
        If Me.Visible Then
            If tmr Is Nothing Then
                tmr = New Timer()
                tmr.Interval = 20
            End If
            If Not tmr Is Nothing Then
            End If
        End If
    End Sub
End Class

Sites in a box

I just read up a bit
on the


product (after our own issues with over-using
.NET, why does everyone else keep sticking it on their product names?) and it
looks pretty cool. Between that, and the many other tools like it, including the

ASP.NET starter kits


, I am starting to wish I had a site to build… all of these tool
kits seem like wonderful ways to jump start a site!

From the InstantKB.NET site: “The End
User License cost is $119 USD per web site, per URL and per server.”
What does that mean? site, url and
server? Do you get to pick one? Is it only that price if you are running one
site on one server with one url (guess it will be a big default.aspx

HREF EXEs are cool.

I have been, since I started using .NET, a big supporter of
the ‘Smart
Client’ or ‘Rich Client’ application
. I’ve talked about it to people, I’ve
dug deep into the underlying technology, I’ve built samples… big fan
of the whole idea

. On a parallel track, I wrote several systems internal
to MSDN using VB.NET and Windows Forms, but I didn’t make any of them into
auto-deploying apps (aka no-touch apps, aka HREF EXEs, etc.). Why not? Habit I
suppose, it just really didn’t occur to me, until after I had sent out a few
updates for each of them, then I felt really silly… I’m not supposed to have
to do this anymore, sending out updates is a thing of the past!

Tonight I converted them all to HREF EXEs. I had a
little snag, it turns out that when IEExec hosts your EXE it doesn’t run it in
the same type of Apartment as when you execute it directly (which doesn’t matter for most
things, but it screws up COM automation and drag and drop), but just adding

System.Threading.Thread.CurrentThread.ApartmentState =

to the start of my app fixed that right up. (and, no, just
adding the STA attribute wouldn’t do it… in case you are

Now, if I build a new version and copy
those files to the appropriate web server directory… bang,
everyone is running the new version the next time they launch the app. No
update, no need to send out a “new version” email, unless I just want to let the
users know what is new… it is a good thing.

Tired now, must stop

Why C# indeed

Early and Adopter
seem to have just noticed my blog;

Duncan Mackenzie’s
blogging, and no one told me!

(And why on earth does he
have C# code on his blog???)

[Sean ‘Early’ Campbell & Scott ‘Adopter’ Swigart’s Radio

and they raised a
good question, why would I (I’m MSDN’s “Content Strategist” for VB, and an
affirmed VB Lover) have C# code on my blog?

It isn’t by choice,
that is for sure! It is his fault: Matt [Mr. Web Services] Powell

I’m doing a little bit of work on some
internal utilities at MSDN and while some of them are in VB.NET, this particular
one was written by that crazy Matt Powell fellow and
it is all in C#. I’ve actually managed to break a few things out into their own
assemblies and do them in VB.NET, but for the most part the UI is all in C#…
what is a guy to do? I’ll try to avoid starting a religous debate here, but I
have to at least say that the C# editor sucks compared to the VB.NET one… XML
commenting aside! I’ve heard it is much closer in features to VB.NET in VS.NET
2003, but I haven’t done anything but VB.NET in that version of VS.NET, so I
don’t really know…

Sadly, after only a few days of
working on this system, I started adding semicolons to my VB.NET code… Is that
like calling your wife by the wrong name?

Not quite ready for prime-time

I have a lot of
code hanging around, and the techniques in that code would likely
help people who are getting started with .NET, but I haven’t had to time to
“polish” it up for public release…

I’m starting to wonder, with the rapid
pace of technology, if I should just release things as they are and tweak later
if I have time… at least they will provide some benefit to some people. If I
wait until I get around to tidying them up, the need for these samples might be
less… hmm… I just hate posting code that I’ve never polished, it is like
having company over without cleaning up. Thoughts?