# C1.Win.C1Editor.C1Editor.SelectionChanged

## Content

<div class="doc-site-dotnet-api-container">




<h1 id="C1_Win_C1Editor_C1Editor_SelectionChanged" data-uid="C1.Win.C1Editor.C1Editor.SelectionChanged" class="text-break">SelectionChanged Event
</h1>
<div class="markdown level0 summary"><p>Occurs when the current selection is changed.</p>
</div>
<div class="markdown level0 conceptual"></div>
<h6><strong>Namespace</strong>: <a class="xref" href="C1.Win.C1Editor.html">C1.Win.C1Editor</a></h6>
<h6><strong>Assembly</strong>: C1.Win.C1Editor.4.8.dll</h6>
<h5 id="C1_Win_C1Editor_C1Editor_SelectionChanged_syntax">Syntax</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public event EventHandler SelectionChanged</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Event SelectionChanged As EventHandler</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.eventhandler">EventHandler</a></td>
      <td>Occurs when the current selection is changed.</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_C1Editor_C1Editor_SelectionChanged_examples"><strong>Examples</strong></h5>
<p>This example shows how to add an &quot;Add Image&quot; button to the form.
<pre><code class="lang-csharp">private void Form1_Load(object sender, EventArgs e)
{
_btnAddImage = new Button();
_btnAddImage.Text = &quot;Add Image&quot;;
_btnAddImage.Click += AddPictureDialog;
this.Controls.Add(_btnAddImage);
<pre><code>           _btnAddImage.Location = new Point(10, 10);

           c1Editor1.DocumentChanged += UpdateUI;
           c1Editor1.SelectionChanged += UpdateUI;
           c1Editor1.ModeChanged += UpdateUI;
        }

        private void AddPictureDialog(object sender, EventArgs e)
        {
           c1Editor1.ShowDialog(DialogType.Image);
        }

        private void UpdateUI(object sender, EventArgs e)
        {
           _btnAddImage.Enabled = c1Editor1.CanShowDialog(DialogType.Image);
        }&lt;/code&gt;&lt;/pre&gt;
</code></pre>
</code></pre>
</div>
