Things I’d forgotten you could do with VB6
My last 2 jobs have involved a large amount of Visual Basic 6 development (amongst T_SQL, C and various script languages), but have been very different in terms of design and implementation of code.
Prior to my current role, the VB6 code was about as cutting-edge as you can get with an 8 year old development environment. Extensive use was made of collections, classes and COM to build a robust central object library that was a breeze to use.
By comparision, the product I’m working with currently has ‘history’, and a lot of it. The only time a class is used is to provide a public interface to an ActiveX control. By and large the majority of the ‘framework’ is implemented in shared modules.
Neither way is the ‘right’ way, both are valid in VB6, one being an object oriented approach and the other very much ‘procedural’. That said it is difficult moving back to procedural programming after writing so much object oriented code.
It’s the procedural code, having been around as long as VB6 itself, that threw up a few surprises for me. Along with the fact that several contributers had their roots in VB to the early versions. That said I don’t remember using some of these features, even way back in VB3…..
Multiple executions on one line of code
foo=1:bar=1
GoSubs!
Private Sub Foo()
GoSub Bar
Exit Sub
Bar:
MsgBox "Hello world!"
Return
End Sub
Option Compare*
Option Compare Text
…and an interesting technique to detect a VB program was running interpreted…..
Debug.Print 1/0
…I’d always for some reason used Debug.Assert to call a function and set a value. I’m sure both techniques have their pros and cons.
* Not strictly ‘forgotten’, just never used, the default binary has always suited.
