Found this in a file called "VB diary.doc". This was my attempt to look into visual basic (vb6, the tool of the day for the New Hossy) and see whether I could use it. It was supposedly object based, and it seems I expected full OOP... I was, obviously, trying to recreate alert.prg in this particular piece of... m$ wisdom.
Thursday, March 09, 2000VB doesn’t have min() and max() functions. Great. I’ll have to write them, too, or guess if they’re part of something that was once bought, and then finding where it may be.
Array dimensions require constants. There’s probably some trick to achieve dynamic dimensioning, but… I didn’t meet this ever since Pascal. All interpreted languages had dynamic arrays, and even strictly compiled languages had their ways around it. Here it is:
You can also use the Dim statement with empty parentheses to declare a dynamic array. After declaring a dynamic array, use the ReDim statement within a procedure to define the number of dimensions and elements in the array. If you try to redeclare a dimension for an array variable whose size was explicitly specified in a Private, Public, or Dim statement, an error occurs.
Well, one more thing to think about.
Button doesn’t have font properties… strange, unless it’s meant to use system buttons only. Well, at least these buttons don’t, i.e. the ones in the Toolbar ActiveX (which I opted to use, because native VB doesn’t have any native CommandGroup object). You may play with individual buttons, though, and try to arrange them somehow. Regular CommandButton has a Font property, but then it has no grouping object you could rely on, and I don’t think I’m ready to create something like that at this stage. Though, I just might. If there’s a way to DIM a collection of buttons, I may be better off than playing with the Toolbar AX. Anyway, this AX is just too visible.
The editor
drives me crazy. Tabs don’t remain tabs, well, not all the time. If you delete them using backspace, it’s a tab; if you delete them using delete key, they go away space by space. If you mark several lines and play with tab and backtab, they don’t align along the lines you indented yesterday. There’s no Beautify to do it for you. One thing I also hate is that the code window never heard of the mouse wheel. One’d expect m$’s favorite child to be equipped with the latest gadgets (c’mon, it’s just one property of the window, it’s supposed to be just another typical Windows window… adjust and recompile, please). The syntax painter doesn’t include an option to paint the strings, which comes very handy when you have to check your quotation marks. Actually, you don’t have to check them anymore, you see when they’re wrong, if the space between them is bright yellow.
Another function I had to write is Between. It is a one-liner, but still it comes handy. I wonder how do I get to have a common module with functions, or a lib, that can be shared between projects. I’ve seen the VBA module functions being called at places, but they had to be prefixed, i.e. there had to be a vba. object instantiated somewhere first, which means you have to load them all at once, or include them all (including ones you don’t need)… the more I know it, the less I hate it.
Debugging
Now this is something. All the windows are there, watch, locals, even immediate window (though for some reason it’s modal and can’t be used while running code, but a debug object can use it for output, which makes it then a DebugOut window). There’s the toolbar, pretty much the same as in the rest of the VS world, with same shortcut keys (like F5 for start, F8 step into), you can put your breakpoints wherever you want – except that it simply shows my form far before the time it’s supposed to be shown, and the code in Sub Main doesn’t seem to run. It’s maybe calling the alert() function I wrote, but then I wouldn’t know. There’s no Trace window, and looking at the code window gives me no clue about where’s my code executing now. After a single Step Into, it disables all the stuff in the debug menu (and the toolbar). Now let’s RTFM. Here’s what the MS propaganda says:
When you're fine tuning your projects, Visual Basic provides all the tools you need to develop an application that runs without a hitch. Here are links to information on tips and tools you can use to make things run perfectly.
Now this is something I’ve always admired: “Visual Basic also includes special debugging features, such as edit-and-continue capability”. Hats off.
Still can’t figure how to single step through code. It says that the ‘step into’ and ‘step over’ are available in break mode only. OK. But when I click the StepInto button, it gets me back into the [run] mode.
Any debugger window can be opened via the toolbar button, but the same button can’t close it. You have to go down there and click the window’s close box. “You can use Step Into to execute code one statement at a time. (This is also known as single stepping.) After stepping through each statement, you can see its effect by looking at your application's forms or the debugging windows.” Does this actually mean you don’t see the code you’re going through?
Nope, you do see it – the trick was in something else: the Sub Main is not automatically the starting point of your project. It’s the first form you have. In the Project Group window it doesn’t have any indication on what’s the main entry point, like having its name in bold in the project group window. So, it turned up to be just another wrong default, long live MS.
Split function (which seems to be very handy) gave me a datatype mismatch when I dimensioned the array it was supposed to return. When I let it use a default automatic creation of the array, it worked. I’m just wandering what would have happened if I set the declarations to be mandatory?
One trouble is that the variables here are local by default… which would mean I’d have to move some declarations into the module level. This is not bad, just a different default, and starting with Alert.prg is just showing that it was written 6 years ago in FPD2.6, purely procedural.
Editor
Pressing Home takes you to the beginning of the line… well, almost. Takes you to the first non-white character in the line; pressing Home again takes you all the way left; further keypresses toggle between these two positions. White space at the end of the line does not get such attention.
An empty collection (in my case, buttons in Toolbar AX) shows Count=0, and has 256 empty members. Nice and cute to have open in the locals window.
Debugger
Treeview-like controls in watch and local windows expand/collapse by mouse only. Pressing plus, minus, asterisk or left-right arrows has no effect. They do react on Enter, though, once you’re on an expandable row. Still, Enter may be the wrongest thing to use, because one always thinks that Enter is the key which closes the window. You don’t always know if what you see is a modal dialogue or not. Nice thing about debugger windows is that you see the class of the object (or at least its origin) and the context where it’s defined.
Given Basic’s history with Lset, Rset and Set statements in general, I omitted the Set statement in an object reference assignment. The error returned was very weird – it complained about the With block object or Set statement object being not defined. The thing really was happening within a With block, so it took me half an hour to divine that it’s nothing wrong with my objects, it’s the SET statement which must be there. Simple equal sign won’t work.; VB has two assignment modes – one for variables, and one for object references.
News at home, from sezam (which I actually couldn't read at the time, but got the archives later, more or less complete): In Požarevac (Sloba's birthplace), the independent Radio Bum 93 was shut down. Allegedly they didn't pay the fee for using the frequency, and they claim they never got any bill of the kind to pay. Also, Golf radio got forbidden for who knows what, their frequency being taken over by some turbo folk singer's station (wtf, they were a sports radio).
One of servers was still (again) used to play Quake.
Brlja emailed with state of affairs at Avai - they're doing payroll for pharmaceutical factory, Svemiks had a virus which fucked up a lot of stuff, and they all kissed Cica for 8th of march yesterday.
24-I-2020 - 28-X-2025