Skip to content

cStartUp Properties Reference

LastError

Gets error message from the last operation.

vb
Public LastError As String

Description

When Toggle method returns False, detailed error description can be obtained via this property.

Examples

vb
Private Sub MenuStartUp_Click()
    If VBMAN.StartUp.Toggle("my-app", App) Then
        VBMAN.Toast.Show "Setting successful"
    Else
        ' Get and show error message
        Dim ErrorMsg As String
        ErrorMsg = VBMAN.StartUp.LastError
        
        MsgBox "Setting failed: " & ErrorMsg, vbCritical, "Error"
    End If
End Sub

Common Errors

Error ScenarioPossible Error Message
Registry operation failedInsufficient permissions or registry locked
Invalid pathSpecified program path does not exist

Internal Constants

Constants used internally by component (no need to use directly):

vb
Const K As String = "HKCU\Software\Microsoft\Windows\CurrentVersion\Run"

This is the Windows system current user's startup item registry location.

VB6 and LOGO copyright of Microsoft Corporation