twinBASIC Update: September 16, 2025

Highlights include an improvement to VanGoghGaming's Picture Converter sample project and a deep dive into the XAML Controls/WinRT technology it runs on.

twinBASIC Update: September 16, 2025

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 week, 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:


Highlights

No major news this week. The latest BETA (version 873) has been out for a few weeks now.

Discord Chat Summary

* Auto-generated via Gemini-2.5-Pro

Overview

The week saw significant community engagement around twinBASIC's development, with new members joining and exploring migration from VB6 projects. Key discussions centered on version control limitations, XAML Islands integration, and language compatibility features. The community provided strong support for newcomers while addressing technical challenges and showcasing advanced COM/WinRT implementations.

New User Onboarding & Migration

  • New member wartale successfully imported a large VB6 project with ActiveX DLL components, noting faster compilation times compared to VB6's optimization-heavy builds
  • Community members guided newcomers through current beta limitations, particularly around version control and the single-file project format stored in .twinproj files
  • yereverluvinunclebert_49972 emphasized that tB is still in beta and advised against production use until v1.0 addresses version control concerns
  • glevz provided workarounds for version control by demonstrating individual file export/import capabilities

Language Compatibility & Features

  • waynephillipsea confirmed that Property Get/Let type mismatches are allowed in tB (following COM rules), unlike VB6's stricter validation
  • Bug identified where tB accepts invalid property syntax (Test(3) = 2 for Property Let) that VB6 properly rejects
  • Discussion around unsigned integer support revealed tB doesn't yet have native unsigned types, requiring VB6-style workarounds
  • IDE improvements requested including alphabetical method insertion for Implements statements and better property validation

XAML Islands & Advanced COM Integration

  • deletedewd demonstrated sophisticated XAML Islands integration with two-way data binding between tB ViewModels and XAML controls
  • Showcased implementation of ICustomPropertyProvider and ICustomProperty interfaces enabling ViewModel binding without .NET metadata requirements
  • Successfully implemented INotifyPropertyChanged for live UI updates, creating bidirectional synchronization between traditional VB controls and XAML Islands
  • mansellan provided valuable context on MVVM patterns and suggested potential language enhancements for simplified binding syntax

Development Tools & AI Integration

  • Community discussion around AI coding assistants revealed mixed experiences with GPT-5, with winsped reporting significant hallucination issues
  • Claude Sonnet and Opus emerged as preferred alternatives for VB6/tB development assistance
  • glevz highlighted Microsoft Copilot's effectiveness for VB6-specific coding questions, noting the need to specify VB6 explicitly

Conclusion

The week demonstrated twinBASIC's growing maturity in handling complex VB6 migrations while revealing areas for continued development. The successful XAML Islands integration showcases tB's potential for modern UI development, while community feedback continues to drive language compatibility improvements. New user enthusiasm remains high despite beta limitations, with the community providing excellent support for migration challenges.

Around the Web

XAML Image Control Sample

VanGoghGaming posted the following in show-and-tell:

Here's the tB version of the VB project from [this vbForums thread].

The PictureBox has been replaced with a XAML Image Control thus eliminating the annoying AutoRedraw bug described above [and in a previous twinBASIC Weekly Update]. It also works great in the IDE since the tB manifests have been updated.

The TB project is available via Discord here.

To get the project to compile, I first made sure to run it in the latest version of twinBASIC (BETA 873). I also had to go to Project > References... and un-check and re-check the "WinRT" package from the "Available Packages" tab. (NOTE: See this earlier article for more info on the "Link Location" text and "Embedded" check box in the screenshot below.)

Here's what the form looks like after opening the project, running it, selecting the "Clockwise 90°" radio button, then clicking [Apply Transforms]. I then placed my mouse over the image and used the mouse wheel to resize it smoothly.

What are XAML and WinRT (in this context)?

I'm vaguely familiar with XAML, but I always associated it more with the declarative XML-based configuration used to design XAML-based interfaces in the .NET framework. That's apparently not a hard and fast requirement to use XAML controls, though.

Here's the Form_Load code from the sample project's main form window:

Private Sub Form_Load()
Dim vItem As Variant, ClientRect As RECTL, ImageStatics As IImageStatics, ColorStatics As IColorsStatics, PointerEvent As New cPointerEvents
    Set ColorStatics = NewObject(Of IColorsStatics)("Colors")
    Set CanvasStatics = NewObject(Of ICanvasStatics)("Canvas"): Set DesktopWindowXamlSource = NewObject(Of IDesktopWindowXamlSource)("DesktopWindowXamlSource")
    If GetClientRect(picPreview.hWnd, ClientRect) Then
        With CType(Of IDesktopWindowXamlSourceNative)(DesktopWindowXamlSource)
            If .AttachToWindow(picPreview.hWnd) = S_OK Then
            hWndIsland = .WindowHandle
                With ClientRect
                    If SetWindowPos(hWndIsland, HWND_TOP, 0, 0, .Right - .Left, .Bottom - .Top, SWP_SHOWWINDOW Or SWP_NOMOVE) = APITRUE Then
                        Set cvContainer = NewObject(Of ICanvas)("Canvas")
                        Set SelectionRectangle = NewObject(Of IRectangle)("Rectangle")
                        CType(Of IUIElement)(SelectionRectangle).Visibility = Visibility_Collapsed
                        With CType(Of IShape)(SelectionRectangle)
                            With .StrokeDashArray: .Append 3: .Append 1: End With
                            .StrokeThickness = 2: Set .Stroke = NewObject(Of ISolidColorBrush)("SolidColorBrush"): CType(Of ISolidColorBrush)(.Stroke).Color = ColorStatics.Blue
                        End With
                        Set picImage = NewObject(Of IImage)("Image")
                        With CType(Of IUIElement)(picImage)
                            .AddPointerPressed PointerEvent.This(Me, PointerPressed): Set PointerEvent = Nothing
                            .AddPointerMoved PointerEvent.This(Me, PointerMoved): Set PointerEvent = Nothing
                            .AddPointerReleased PointerEvent.This(Me, PointerReleased): Set PointerEvent = Nothing
                            .AddPointerWheelChanged PointerEvent.This(Me, PointerWheelChanged)
                        End With
                        Set ImageStatics = NewObject(Of IImageStatics)("Image"): picImage.SetBinding ImageStatics.SourceProperty, NewObject(Of IBinding)("Binding")
                        With CType(Of IVector_IUIElement)(CType(Of IPanel)(cvContainer).Children): .Append picImage: .Append SelectionRectangle: End With
                        Set DesktopWindowXamlSource.Content = cvContainer: SubclassWnd picPreview.hWnd, GetSubclassPointer(Me)
                    End If
                End With
            End If
        End With
    End If
    Set BitmapDecoder = New cBitmapDecoder: Set BitmapEncoder = New cBitmapEncoder
    For Each vItem In BitmapDecoder.GetDecoderInformation: cmbDecoderCodecs.AddItem vItem: Next vItem
    For Each vItem In BitmapEncoder.GetEncoderInformation: cmbEncoderCodecs.AddItem vItem: Next vItem
    cmbDecoderCodecs.ListIndex = 0: cmbEncoderCodecs.ListIndex = 2: cmdDecode_Click
End Sub

I had an extended discussion with Claude Opus 4.1 about the topic of XAML, WinRT, twinBASIC, and how it may or may not integrate with Microsoft Access. Here's the result of that conversation:


VanGoghGaming Updates XAML Islands Image Viewer with Smooth Zoom and Selection

VanGoghGaming has released an impressive update to his image converter project on vbForums, this time replacing the traditional PictureBox with a XAML Image Control via XAML Islands technology. This isn't just a minor tweak—it's a complete modernization that "bridges technologies several decades apart," using WinRT objects with a control that provides genuinely smooth zooming via mouse wheel and a customizable selection rectangle that puts the old DrawFocusRect API to shame.

The technical achievement here is substantial. VanGoghGaming's WinRT TypeLib has grown from 150KB to 2.8MB and now includes all XAML controls—essentially providing twinBASIC developers with access to the entire modern Windows UI toolkit. The sample demonstrates practical implementations of pointer events (Microsoft's modern replacement for mouse events), including PointerWheelChanged which enables smooth zoom in/out effects using Scale Transform in real time. No subclassing required—these events are handled directly through the modern control interfaces.

For Access developers watching from the sidelines, this project offers a tantalizing glimpse of what modern UI capabilities could look like in the VB/VBA world. The smooth zooming, crisp image rendering, and responsive selection rectangle are the kinds of polish that Access forms have been missing for over a decade. While VanGoghGaming correctly notes that VBA can't directly use XAML Islands without manifest modifications (making it impractical for distributed Access applications), his work proves that twinBASIC can successfully bridge this gap.

The updated sample maintains all the original functionality—converting between image formats, applying transforms like scaling, flipping, and rotating, and saving in different formats—while demonstrating that legacy VB code concepts can be successfully modernized with contemporary Windows technologies. With the twinBASIC IDE now properly supporting these manifests, developers can experiment with these modern controls directly in the development environment.

It's another example of how twinBASIC is quietly becoming the most viable path for modernizing VB6 and potentially VBA applications without complete rewrites.


Changelog

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.
  • No new releases this week.

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