Unable to reload the form once ive saved it

When I try to reopen a basic form that I’ve designed in VS2019 or the pad. I’m unable to reopen the save form? When it open I just get a blank design form?
thanks

Hey @thenecroscope,

Can you share the form code you are trying to reopen? This is usually any issue with the designer parsing the code.

$PowerShellFormProject1_Load = {

}

$testToolStripMenuItem_Click = {

}

$generateToolStripMenuItem1_Click = {
Write-Debug “hello”
}

$menuStrip1_ItemClicked = {

}

$generateToolStripMenuItem_Click = {
Write-Host “hello”
}

. (Join-Path $PSScriptRoot ‘PowerShellFormProject1.designer.ps1’)

$PowerShellFormProject1.ShowDialog()


[void][System.Reflection.Assembly]::Load(‘System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’)
[void][System.Reflection.Assembly]::Load(‘System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’)
$PowerShellFormProject1 = New-Object -TypeName System.Windows.Forms.Form
[System.Windows.Forms.MenuStrip]$menuStrip1 = $null
[System.Windows.Forms.ToolStripMenuItem]$fileToolStripMenuItem = $null
[System.Windows.Forms.ToolStripMenuItem]$fileToolStripMenuItem1 = $null
[System.Windows.Forms.ToolStripMenuItem]$generateToolStripMenuItem = $null
[System.Windows.Forms.ToolStripMenuItem]$fileToolStripMenuItem2 = $null
[System.Windows.Forms.ToolStripMenuItem]$generateToolStripMenuItem1 = $null
[System.Windows.Forms.ToolStripMenuItem]$fileToolStripMenuItem3 = $null
[System.Windows.Forms.ToolStripMenuItem]$testToolStripMenuItem = $null
[System.Windows.Forms.ToolStripMenuItem]$fileToolStripMenuItem4 = $null
[System.Windows.Forms.ToolStripMenuItem]$editToolStripMenuItem = $null
[System.Windows.Forms.ToolStripMenuItem]$testToolStripMenuItem1 = $null
[System.Windows.Forms.Button]$button1 = $null
function InitializeComponent
{
$menuStrip1 = (New-Object -TypeName System.Windows.Forms.MenuStrip)
$fileToolStripMenuItem = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$fileToolStripMenuItem1 = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$generateToolStripMenuItem = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$fileToolStripMenuItem2 = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$generateToolStripMenuItem1 = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$fileToolStripMenuItem3 = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$testToolStripMenuItem = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$fileToolStripMenuItem4 = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$editToolStripMenuItem = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$testToolStripMenuItem1 = (New-Object -TypeName System.Windows.Forms.ToolStripMenuItem)
$menuStrip1.SuspendLayout()
$PowerShellFormProject1.SuspendLayout()

#menuStrip1

$menuStrip1.Items.AddRange([System.Windows.Forms.ToolStripItem[]]@($fileToolStripMenuItem4,$editToolStripMenuItem))
$menuStrip1.Location = (New-Object -TypeName System.Drawing.Point -ArgumentList @([System.Int32]0,[System.Int32]0))
$menuStrip1.Name = [System.String]‘menuStrip1’
$menuStrip1.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]515,[System.Int32]24))
$menuStrip1.TabIndex = [System.Int32]0
$menuStrip1.Text = [System.String]‘menuStrip1’
$menuStrip1.add_ItemClicked($menuStrip1_ItemClicked)

#fileToolStripMenuItem

$fileToolStripMenuItem.Name = [System.String]‘fileToolStripMenuItem’
$fileToolStripMenuItem.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]37,[System.Int32]20))
$fileToolStripMenuItem.Text = [System.String]‘File’

#fileToolStripMenuItem1

$fileToolStripMenuItem1.Name = [System.String]‘fileToolStripMenuItem1’
$fileToolStripMenuItem1.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]37,[System.Int32]20))
$fileToolStripMenuItem1.Text = [System.String]‘File’

#generateToolStripMenuItem

$generateToolStripMenuItem.Name = [System.String]‘generateToolStripMenuItem’
$generateToolStripMenuItem.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]180,[System.Int32]22))
$generateToolStripMenuItem.Text = [System.String]‘Generate’
$generateToolStripMenuItem.add_Click($generateToolStripMenuItem_Click)

#fileToolStripMenuItem2

$fileToolStripMenuItem2.Name = [System.String]‘fileToolStripMenuItem2’
$fileToolStripMenuItem2.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]37,[System.Int32]20))
$fileToolStripMenuItem2.Text = [System.String]‘File’

#generateToolStripMenuItem1

$generateToolStripMenuItem1.Name = [System.String]‘generateToolStripMenuItem1’
$generateToolStripMenuItem1.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]180,[System.Int32]22))
$generateToolStripMenuItem1.Text = [System.String]‘Generate’
$generateToolStripMenuItem1.add_Click($generateToolStripMenuItem1_Click)

#fileToolStripMenuItem3

$fileToolStripMenuItem3.Name = [System.String]‘fileToolStripMenuItem3’
$fileToolStripMenuItem3.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]37,[System.Int32]20))
$fileToolStripMenuItem3.Text = [System.String]‘File’

#testToolStripMenuItem

$testToolStripMenuItem.Name = [System.String]‘testToolStripMenuItem’
$testToolStripMenuItem.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]180,[System.Int32]22))
$testToolStripMenuItem.Text = [System.String]‘Test’
$testToolStripMenuItem.add_Click($testToolStripMenuItem_Click)

#fileToolStripMenuItem4

$fileToolStripMenuItem4.DropDownItems.AddRange([System.Windows.Forms.ToolStripItem[]]@($testToolStripMenuItem1))
$fileToolStripMenuItem4.Name = [System.String]‘fileToolStripMenuItem4’
$fileToolStripMenuItem4.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]37,[System.Int32]20))
$fileToolStripMenuItem4.Text = [System.String]‘File’

#editToolStripMenuItem

$editToolStripMenuItem.Name = [System.String]‘editToolStripMenuItem’
$editToolStripMenuItem.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]39,[System.Int32]20))
$editToolStripMenuItem.Text = [System.String]‘Edit’

#testToolStripMenuItem1

$testToolStripMenuItem1.Name = [System.String]‘testToolStripMenuItem1’
$testToolStripMenuItem1.Size = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]180,[System.Int32]22))
$testToolStripMenuItem1.Text = [System.String]‘Test’

#PowerShellFormProject1

$PowerShellFormProject1.ClientSize = (New-Object -TypeName System.Drawing.Size -ArgumentList @([System.Int32]515,[System.Int32]261))
$PowerShellFormProject1.Controls.Add($menuStrip1)
$PowerShellFormProject1.MainMenuStrip = $menuStrip1
$PowerShellFormProject1.Name = [System.String]‘PowerShellFormProject1’
$PowerShellFormProject1.add_Load($PowerShellFormProject1_Load)
$menuStrip1.ResumeLayout($false)
$menuStrip1.PerformLayout()
$PowerShellFormProject1.ResumeLayout($false)
$PowerShellFormProject1.PerformLayout()
Add-Member -InputObject $PowerShellFormProject1 -Name base -Value $base -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name menuStrip1 -Value $menuStrip1 -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name fileToolStripMenuItem -Value $fileToolStripMenuItem -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name fileToolStripMenuItem1 -Value $fileToolStripMenuItem1 -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name generateToolStripMenuItem -Value $generateToolStripMenuItem -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name fileToolStripMenuItem2 -Value $fileToolStripMenuItem2 -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name generateToolStripMenuItem1 -Value $generateToolStripMenuItem1 -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name fileToolStripMenuItem3 -Value $fileToolStripMenuItem3 -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name testToolStripMenuItem -Value $testToolStripMenuItem -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name fileToolStripMenuItem4 -Value $fileToolStripMenuItem4 -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name editToolStripMenuItem -Value $editToolStripMenuItem -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name testToolStripMenuItem1 -Value $testToolStripMenuItem1 -MemberType NoteProperty
Add-Member -InputObject $PowerShellFormProject1 -Name button1 -Value $button1 -MemberType NoteProperty
}
. InitializeComponent

I’m on 16.5.4 of vs 2019

It’s working now :slight_smile: it looks as though its something to do with not running pad with the elevate administrator permissions.

Hi,
I’m having real problems with this. I keep creating menu structures but the nested menus are being deleted or not saved correctly. Its starting to get frustrating as I keep losing work. Do you have a new version of your app?

thanks,

This looks like a bug to me. You’re on the most recent version so we will have to resolve the issue inside the form designer.