Category Archives: Winforms

Check if the string end or start with any of the element in an array in C#

We may have used normal EndsWith() extension for the string to check if the string ends with a specific string or character. But, did you ever encountered a situation where you have to check if the string ends with or starts with any of the given strings, may be an array ?. Well I have, and so I wrote an extension for checking if a string ends or starts with any of the element in an array in C#. Once you have this in a static class, say StringExtensions, you can use it in your application if you have access to that class.

Well, I did not use much comments since as you can see its almost self explanatory. Quite simple to do, right ?. Happy coding guys.

How to clear cache of web browser control in C#

Its been a long time since I wrote anything here. So I decided to come with something very interesting. It is often a headache when we work with web browser control in C#. Clearing cache in web browser control will be a requirement in some cases. I had the same issue once, and I asked to my friend “google”, as always he gave me a solution. I got a code from internet. It was a bit messy and buggy. I modified it in my way, simplified it. Now I have a perfect code to clear cache in web browser control. I am sharing it with you guys..

This was a great addition to my code vault. I hope it will be helpful for you. Cheers

How to remove all event handlers from a control – C# winforms

A few days ago I was stuck in a problem. I was in need of removing certain events from controls that i have on my form. I spend almost 3 hours googling for a suitable code and I found this article in stackoverflow. It helped me alot.

The code I got from there was meant to remove click event from a button. I need to remove double click events from some panels and click events from some buttons. So i made a control extension, which will remove all eventhandlers for a certain event.

Now, the usage of this extenstion.

If you need to remove click events from a button,

If you need to remove doubleclick events from a panel,