Archive for category Code Snippets

.NET Serialization: Binary, SOAP, and XML (VB)

In .NET when you need to shrink an object into a more portable format you have 3 choices.  Binary, SOAP, or XML.  The process of shrinking and expanding the object is called serialization and deserialization.  Each option has it’s own advantages which I will explain. Binary You can serialize an object into binary format quite [...]

, , , , ,

No Comments

Cross-thread operation not valid: .NET Cross Threading To Update Form Control

So you get the “Cross-thread operation not valid” error because you are trying to update an object on your form from a thread. I am not going to try to “glamor” you (True Blood reference) with fundamentals of delegates, threading, etc. If that is what you are looking for, search Google and you will find [...]

, ,

No Comments

A .NET Bit.ly API Helper Class (Visual Basic.NET)

I decided to write a helper class for using the Bit.ly API for creating short urls.  You know, those tiny links that you see all over Facebook, Twitter, etc.  The snippet below shows how you would use the helper class.  Not only can you shorten an url, you can shorted multiple urls in a single [...]

, , , , ,

No Comments

Custom Replace with Regular Expressions in .NET

This is the second time I have had to do something like this.  So this time I am posting it for my reference.  Regular expressions are amazing and amazingly difficult to understand sometimes, but they come in very handy.  I was in a situation where I was going to need to  feed in a custom [...]

, , ,

No Comments