---
title: "Can I create this type of event in C#?"  
description: "Can I create this type of event in C#?"  
author: "Anonymous User"  
published: 2013-08-10  
updated: 2013-08-10  
canonical: https://www.mindstick.com/forum/1370/can-i-create-this-type-of-event-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Can I create this type of event in C#?

I have a List in my custom [user control](https://www.mindstick.com/forum/294/problem-in-access-the-control-inside-the-user-control). I'd like the control to redraw the each Image in the List whenever the contents of that list is changed. Either a [movement](https://yourviews.mindstick.com/view/81374/black-lives-matter-movement-hijacked-by-american-leftist-hippies), addition or [removal](https://www.mindstick.com/articles/13061/laser-tattoo-removal) of an items should fire an event.

using [System](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business);

using System.Collections.Generic;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Linq;

using System.Text;

using System.Windows.Forms;

[namespace](https://www.mindstick.com/articles/12552/namespace) WebServiceScanner

{

public [partial](https://www.mindstick.com/blog/78/partial-class-in-dot-net) class imageList : [UserControl](https://www.mindstick.com/forum/12739/set-the-enabled-property-of-a-usercontrol-from-codebehind)

{

public imageList()

{

InitializeComponent();

}

public List<Image> Images { get; set; }

[public void](https://www.mindstick.com/interview/2715/can-we-write-static-public-void-instead-of-public-static-void) AddImage(Image image)

{

Images.Add(image);

}

public void RemoveImage(Image image)

{

Images.Remove(image);

}

public void MoveImageLeft(int index)

{

Image tmpImage = Images[index];

Images[index] = Images[index - 1];

Images[index - 1] = tmpImage;

}

public void MoveImageLeft(int index)

{

Image tmpImage = Images[index];

Images[index] = Images[index + 1];

Images[index + 1] = tmpImage;

}

}

}

Can this be done?

Thanks for your [guidance](https://answers.mindstick.com/qa/94097/which-missile-was-developed-under-a-p-j-abdul-kalam-s-guidance)! Eager to learn!

## Replies

### Reply by Pravesh Singh

```
public partial class imageList :
UserControl    {         public event
OnChange;         public imageList()        {           
InitializeComponent();        }         public List<Image> Images { get; set; }         public void
AddImage(Image image)        {           
Images.Add(image);            this.OnChange();        }         public void
RemoveImage(Image image)        {           
Images.Remove(image);            this.OnChange();        }         public void
MoveImageLeft(int index)        {           
Image tmpImage = Images[index];           
Images[index] = Images[index - 1];           
Images[index - 1] = tmpImage;            this.OnChange();        }         public void MoveImageLeft(int index)        {           
Image tmpImage = Images[index];           
Images[index] = Images[index + 1];           
Images[index + 1] = tmpImage;            this.OnChange();        }    }
```


---

Original Source: https://www.mindstick.com/forum/1370/can-i-create-this-type-of-event-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
