# Windows Forms Designer

{% hint style="info" %}
The Windows Form Designer is only supported on Windows.
{% endhint %}

{% embed url="<https://youtu.be/LULI64meTUs>" %}
Building A Windows Form with PowerShell in Visual Studio Code
{% endembed %}

## Creating a New Form

Create a PowerShell script by clicking File \ New File, entering the name of the file with a `.PS1` extension. This will be the script that is used to launch your form.&#x20;

## Opening the Designer

To open the designer press `Ctrl+Shift+P` and then type `Show Windows Forms Designer` . The `PowerShell Pro Tools: Show Forms Designer` command should be show. Click or press enter. &#x20;

You can also open a form by clicking the Show Windows Forms Designer button in the tool bar of a PS1 file.&#x20;

![](/files/-MLItSO51IwWk1NLCbOw)

## Working with the Designer

The designer is very much like the standard Visual Studio designer. The design surface on the left allows you to modify your form. You can resize and delete controls from the bottom.

On the right right it provides a toolbox with controls that can be selected and placed on the form. The add a new control, click the control you'd like to place and then click the design surface of where you would like to place the control.&#x20;

Below the toolbox is the properties dialog. You can select a control and modify its properties within this control.&#x20;

On the bottom of the designer is a status bar. It displays the file that is being modified by the designer. An asterisk will be shown when the form is modified.&#x20;

![](/files/-LU73h7_sjSmyrDnKmw0)

## Event Handlers

To implement an event handler, double click on the control you'd like to add the event handler to. It will automatically generate the event handler code in Visual Studio Code.&#x20;

Event handlers can also be generated by clicking the event handler tab in the property pane.&#x20;

![Event handler pane](/files/-LeTshJGu5PyHxqrIGa-)

To create a new event handler, type the name of the handler in the text box next to the event handler. Once you press enter and then save the form, with Ctrl+s or the Save button, the event handler will be generated in the code file.&#x20;

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.poshtools.com/powershell-pro-tools-documentation/visual-studio-code/windows-forms-designer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
