twinBASIC Update: June 5, 2024

Highlights include a new experimental Project Explorer IDE panel, a proposal for "Unsafe" block syntax, and tB-compatible sample code for getting the external IP.

twinBASIC Update: June 5, 2024

On April 23, 2021, I helped Wayne Phillips introduce the world to twinBASIC at the Access DevCon Vienna conference.  I boldly predicted that twinBASIC (along with the Monaco editor) would replace VBA and its outdated development environment by 2025.  With that goal in mind, this weekly update is my attempt to keep the project fresh in the minds of the VBA development community.

Every Sunday Monday, I will be providing updates on the status of the project, linking to new articles discussing twinBASIC, and generally trying to increase engagement with the project.  If you come across items that should be included here, please leave a comment below.

Here are some links to get involved with the project:


Project Explorer (Experimental)

From Wayne in Discord:

BETA 547 includes the new project explorer.  Being experimental, you need to switch to it using this new icon, or press CTRL+R:
If your CPU is slow, you may find that scrolling the list will not give instantaneous results, but should still be usable.  I will improve the render speed of the list in a future update.

At the moment, adding a new component will switch back to file-view, until this is supported natively in the object-view.

The style/behaviours of the new tree more closely matches normal Windows controls than the file-view mode.  We'll probably need to do a little work on file-view mode to bring it in line
Icons for the new Project Explorer feature courtesy of sokinkeso

Discord Chat Summary

* Auto-generated via Claude-2-100k on

This week in the twinBASIC general channel, the community discussed various aspects of the language's development, including bug fixes, new features, and comparisons to other languages. Below are the key points from the conversations over the past week.

Key Points

  • Image Box Issues:

    • User jlegg5 reported issues with picture and image boxes, noting missing properties and inability to change some existing ones. The problem was resolved by copying the project to a new Standard EXE instance, indicating possible library corruption.
  • Custom Control Debug Info:

    • fafalone noted that the WaynesButton custom control was printing debug information, which was identified as a minor issue rather than a bug.
  • VBScript Deprecation:

    • The community discussed the recent announcement of VBScript deprecation by Microsoft, highlighting potential opportunities for twinBASIC to fill the gap.
  • Access Database Integration:

    • jlegg5 shared a method to get the current database file in Access from the VBE, using a custom function to retrieve the application object.

      Public Function callerApplicationObject() As Object
          ' Function implementation here
      End Function
  • .OnAction Property in VBE:

    • There was a discussion about the .OnAction property not working in twinBASIC when used from the VBE. Alternatives like VBIDE.CommandBarEvents were suggested.
  • BETA 546 ActiveX Control Issue:

    • wqweto reported that the stock ActiveX Control project compiled but was missing in the VB6 Components dialog. The issue was resolved by ensuring the control was registered correctly.
  • Project Explorer Update:

    • Wayne Phillips announced the upcoming project explorer feature, which will provide a switch between file-view and object-view, enhancing the development experience.
  • Handling Large Integer Multiplications: - A user encountered a runtime overflow error when multiplying integers that exceeded the 32,000 limit. The solution involved casting one of the variables to Long before multiplication: cash = CLng(num) * CLng(stime)

  • Community Recognition: - twinBASIC was ranked #3 in a Slant survey of BASIC-like programming languages, with no cons listed in the review, highlighting the positive reception from the community.


This week saw significant discussions around bug fixes, new features, and community recognition for twinBASIC. The introduction of the project explorer and handling of VBScript deprecation were notable highlights. The community continues to actively engage in improving the language and sharing solutions to common issues, demonstrating the collaborative spirit driving twinBASIC's development forward.

Around the Web

Unsafe Syntax Proposal

As proposed by Andrew Mansell in GitHub:

Credit: this idea is entirely inspired by @fafalone and Niya from this VBF thread -

VB6 developers have devised incredible ways of extending what the language can do over the years, using (amongst other things) assembly thunks and direct pointer manipulations. These can all be directly applied to twinBASIC, except for patches to the VB6 runtime internals, which are obviously not supportable. Such advanced techniques step outside the normal safety guarantees that VB6 provides for "normal" code - checking for array bounds, null reference accesses etc. Regardless, such code is valid VB6 and must be supported unmodified by twinBASIC for backwards compatibility.

However, twinBASIC has the opportunity in the future to provide easier ways to achieve many of these capabilities. Raw pointers might be allowed natively. Instead of assembly thunks, we could have inline assembly (or C?)*

My proposal is that if new, "dangerous" features are added, it makes sense to require users opt into them. I propose that a new syntax be added:
Begin Unsafe
   ' Here be dragons...
End Unsafe
C# (although not VB.Net) has a similar concept - if you want to step outside of managed code you can, but you need to opt in with an unsafe block.

* Re inline C... which version? which compiler? It's a quagmire. Comments invited.

Be sure to drop a comment on the GitHub issue page if you have thoughts on the idea.

Get External IP Address Using Only Local Network Hardware

While the sample code for this technique is not tB-specific (it also runs in VB6, 32-bit VBA, and 64-bit VBA), I did find it interesting that fafalone now prefers the tB IDE to the VB6 IDE when developing code intended to run universally in all four environments (from Discord):

Not tB-exclusive but it's good for now to write universal compatibility stuff like this; it works in VB6, VBA, and of course tB, which I used to develop it as now that I've gotten really used to it, the tB IDE is better than VB6, even with CodeSMART. 64bit APIs are included for VBA compatibility; doesn't use WinDevLib, though that's where the definitions were pulled from, so you could just delete them and let WDL take over unchanged if you were building a larger project with it.
[VB6; VBA/twinBASIC 32bit/64bit] Code snippet: Get outside IP without 3rd party site-VBForums
It’s useful to not have to rely on some 3rd party website to determine your outside IP, as all examples I could find do-- since the most common site used by those examples is now dead, to show what happens when you rely on them. I was able to make this work by using the common UPnP protocol support …


Here are the updates from the past week.  You can also find this information by visiting the GitHub twinBASIC Releases page.

Releases · WaynePhillipsEA/twinbasic
Contribute to WaynePhillipsEA/twinbasic development by creating an account on GitHub.

ChatGPT Changelog Summary

* Auto-generated via ChatGPT, sorted in order of ChatGPT's opinion of "most impactful changes."

Here's a concise summary of the notable updates in twinBASIC:

  • Improved Callstack Panel: Enhancements include numeric tooltips on hover and visual tweaks for better usability.
  • Breakpoint Preservation: Active breakpoints are now preserved when switching between documents, improving debugging efficiency.
  • Form Designer Auto-Reload: The form designer will automatically reload if a compiler restart occurs during its loading process.
  • Control Array Event Handlers: The 'Index As Integer' parameter for control arrays now has compile-time verification.
  • [DllStackCheck(False)] Attribute: Introduced for DLL Declares to reduce code generation size on 32-bit API calls.
  • Experimental Object View: Added to the PROJECT EXPLORER panel for a new way to navigate project elements.
  • IDE Command for Project Explorer: New command 'tbProjectExplorer_ToggleFileMode' (CTRL+R) for toggling the file mode in the project explorer.

WARNING: The following issues are present in BETA builds 546 - 547 (the latest build as of publication):

  • there are known memory leaks in these versions, so memory usage will be higher than normal

BETA 546

  • fixed: when root project folder node is not expanded in the PROJECT EXPLORER, adding a new item caused an IDE exception
  • improved: mouse hover over an active callstack entry would show a numeric tooltip (internal data)
  • improved: some minor visual tweaks to the callstack panel
  • improved: switching between documents will now preserve the active breakpoint when returning to the document containing it
  • fixed: CustomControls examples now working again (disabled since BETA 424)
  • improved: if compiler restart occurs during form designer loading, the form designer will now reload automatically once compiler services are re-established
  • improved: the control array 'Index As Integer' parameter on event handlers datatype was not being verified/enforced at compile time
  • added: [DllStackCheck(False)] attribute for DLL Declares giving minor codegen size reduction on 32-bit API calls.  Project scope option coming later.

BETA 547

  • added: experimental 'object view' for PROJECT EXPLORER panel
  • added: IDE command 'tbProjectExplorer_ToggleFileMode' (default key binding: CTRL+R)

All original code samples by Mike Wolfe are licensed under CC BY 4.0