Microsoft Forms 20 Object Library Vb6 Today
With Controls.Add("Forms.TextBox.1", "txtName") .Left = 70 .Top = 10 .Width = 200 End With
Private Sub Form_Load() With ComboBox1 .ColumnCount = 2 ' Set the control to display 2 columns .BoundColumn = 1 ' The value returned comes from column 1 .TextColumn = 2 ' The text displayed in the box comes from column 2 ' Add rows of data .AddItem "EMP001" .List(0, 1) = "John Doe" .AddItem "EMP002" .List(1, 1) = "Jane Smith" End With End Sub Use code with caution. Example 2: Handling the Forms 2.0 TextBox Change Event
| Error Message | Possible Cause(s) | Solution(s) | | :--- | :--- | :--- | | "Error 7 - Out of Memory" | The application is being run on a machine without Office installed. Microsoft has flagged the use of FM20.DLL as problematic. | This is the classic distribution problem. The best solution is to ensure Microsoft Office is installed on the target machine or to remove the library from the project. | | "Component 'FM20.dll' or one of its dependencies not correctly registered" | The file is missing, unregistered, or the registry entry is corrupted. | Re-register the DLL. Open a command prompt as an administrator and navigate to the folder containing FM20.dll (usually C:\Windows\SysWOW64 for 64-bit systems). Type regsvr32 FM20.dll and press Enter. | | The controls appear on the form but do not function (click events fire, but no visible change). | The MSForms controls are windowless, meaning they do not have a standard window handle (hwnd). This can cause rendering issues in some scenarios. | This is a known limitation of the library. Consider if a different control or a more robust method is needed. |
Command buttons and labels feature advanced picture positioning properties ( PicturePosition ), allowing text and images to be aligned in various configurations. How to Implement Forms 2.0 in VB6 microsoft forms 20 object library vb6
A new set of distinct control icons will appear in your VB6 Toolbox, ready to be dragged and dropped onto your forms. Step-by-Step Implementation Examples
Creating a multi-column dropdown in native VB6 requires complex Windows API calls or expensive third-party controls. The FM20.DLL ComboBox and ListBox controls feature built-in ColumnCount , ColumnWidths , and List properties, making multi-column data binding straightforward. 3. Visual Styling and Behavior
If you compile a VB6 application using FM20 controls and attempt to run or develop it on a machine that does not have Microsoft Office installed, the application will fail with a runtime or compilation error stating that the control is not licensed. Proper Deployment Strategy According to official Microsoft documentation: With Controls
' Create a button Set btn = frm.Controls.Add("FM20.CommandButton") btn.Caption = "Click Me" btn.Left = 10 btn.Top = 10
Private Sub btnSubmit_Click() MsgBox "Customer: " & txtName.Text & vbCrLf & _ "Active: " & IIf(chkActive.Value, "Yes", "No") Unload Me End Sub
While FM20 is powerful, it wasn't originally designed for standalone VB6 applications. Keep these "gotchas" in mind: The Distribution Dilemma | This is the classic distribution problem
This code snippet demonstrates how to leverage the Controls collection to interact with all MSForms controls on a form. Similar techniques can be used for other controls.
' Add a row with data (semicolon-separated) ListBox1.AddItem "1;John Doe;Admin" ListBox1.AddItem "2;Jane Smith;User"
when done: