# Getting Started with CVB.Net

**URL:** <https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246>\
**Category:** .Net API\
**Tags:** csharp, tutorial\
**Created:** [September 9, 2019, 10:00pm UTC](https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246 "2019-09-09T22:00:00Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![parsd](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/parsd/32/7_2.png) [@parsd](https://forum.commonvisionblox.com/u/parsd)\
**Post date:** [September 11, 2019, 11:54am UTC](https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246/9 "2019-09-11T11:54:42Z")

</div>

# Processing with the `StreamHandler` (Windows Forms)

This post continues on the project created at:

> [@parsd](#):
>
> # Display a Stream (Windows Forms)

The `StreamHandler` is designed to work like the _Image ActiveX_ control (without being an ActiveX control 👍). Thus it also has events to notify you on new images and errors:

- `NewImage` event
- `Error` event

If you know how the old _Image ActiveX_ and _Display ActiveX_ controls worked or you simply wondered how the `Display` knew that a new image arrived: The :cvb: `Image` has a `PixelContentChanged` event which the `Display` registers to. All our SDK methods changing the pixel data raise this event. That is why we didn’t need to implement the `NewImage` events to refresh the `display` in our simple _CvbViewer_ app.

To implement the events we select our `streamHandler` on the Form’s Designer view and switch to the events in the _Properties_:

 ![grafik](https://canada1.discourse-cdn.com/flex027/uploads/commonvisionblox/original/1X/1a121a894dc499d3e8b1b9ee0cdb866179651bbf.png)  
Here we double-click on both the _Error_ and the _NewImage_ events to register them. These events are called from the UI thread-context! So the good news is that you are able to directly manipulate your UI elements. The bad news is that, if you do lengthy processing, your UI hangs or at least becomes laggy.

There are ways on how to work around the lags. C# has the `async`/`await` keywords to do asynchronous processing. And probably you did see the `NewImageAsync` and `ErrorAsync` events. These are not the prefered solution, though – these are for the scenario that you started with the `NewImage` event and later found out that your UI becomes too laggy. This is an easier migration path to use `async`/`await` without rewriting your app. The prefered way is

> `Stemmer.Cvb.Async`

**Attention:** It is out of the scope of this getting started to go into the details of asynchronous processing. Often this is also paired with parallel processing which is not a beginners topic anymore. If you are an expert: yes, we support that in multiple ways. 🙂

---

_[View the full topic](https://forum.commonvisionblox.com/t/getting-started-with-cvb-net/246)._
