> For the complete documentation index, see [llms.txt](https://tldocs.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tldocs.gitbook.io/documentation/development/framework/window-handling-object/opening.md).

# Open

## Opening

Used to initialize data, does not work with visual controls.

The method is followed by Opened()

```csharp
public override bool Opening()
{
    // at this moment, a user's permission to open the module could be denied
    
    rmView = new dsRmView();
    rmView.Material.Table.Columns.Add("rueckm_material", typeof(DataRowView));
    rmView.Fertigartikel.Table.Columns.Add("rueckm_fertigartikel", typeof(DataRowView));
    
    // the BusinessObject is created after the execution of:
    return base.Opening();
}
```

## Opened

Used for visual initializations.

The module is loaded, but not displayed yet. The method is followed by PostOpen()

```csharp
public override void Opened()
{
    base.Opened();
    
    // Retrieve data; 
    BusObj.DataSetRetrieved += (sender, e) 
        => Bind();

    // set DataSource for controals
    Bind();
    
    // visual initializations
    dgMaterialFertigCsnr.ShownEditor += (sender, e) 
        => this.InvokeOnMainThreadWithDelay(RefreshMaterialFertigCsnrFilter);
    
    dgMaterialBadge.BadgeClicked += (sender, e) 
        => OpenMaterialDetails();
    dgFertigArtikelBadge.BadgeClicked += (sender, e) 
        => OpenFertigartikelDetails();
    
   // create new row in the DataSet
    NewKopf();
}
```

{% hint style="success" %}
Best practice: when opening a module, create a new row in the DataSet; otherwise we edit a non-existent row and the changes cannot be saved
{% endhint %}

## PostOpen

Is the place where we can set focus

The module is loaded and displayed.

```csharp
public override void PostOpen()
{
    base.PostOpen();
    FocusFirstEditableField();
}
```

```csharp
public virtual void FocusFirstEditableField()
{
    tbsBetriebsauftrag.Focus();
}
```
