vbnet
VB.NET - Different Output in Designer VS Runtime
· ☕ 2 min read
Let's say you want your custom control display empty string in a certain field, if it has a default value. For example, if your Text field on a custom Label control is identical to its name, show Text field as blank. Would be nice if it worked both ways, i.e. leaving Text field blank would make it identical to the name (or following a certain pattern).

VB.NET - Thread Safe Progress Bar
· ☕ 1 min read
Normally, when you are using .NET built-in progress bar in a multi-threaded application without Callback tricks, you are likely to get an exception on value assign. I recently wrote a fairly simple wrapper class, which solves the problem.

VB.NET - Extract an Image Embedded as a Resource
· ☕ 1 min read
Here's one of the ways to embed an image into EXE file Left click the file in the project tree Set [Build Action] -> [Embedded Resource]. And here's how you can access this file in code...

VB.NET - Nullable DateTimePicker
· ☕ 2 min read
One of the popular ways to do this - change format to " " (space) whenever null value is being set and roll it back to the old format on anything else. I have been looking for clean implementation of this approach. In the end I decided to write my own, using source code available on the net. Here is what I came up with.

VB.NET - Format DateTime With Milliseconds
· ☕ 1 min read
Despite what people are saying on the net, you do not need to write your own method to include milliseconds when formatting DateTime object. To achieve this, you can use “f”. For example, if you want to include thousands of a second (i.e. milliseconds), you can write something like this [...]

VB.NET – Immediate Window – System Error &H80040013&
· ☕ 1 min read
This appears to be a known bug in Visual Studio. I encountered it when my VS 2008 SP1 was idle for a considerable amount of time, hanging minimized in the task bar. Standard close/reopen VS did not help. There were no strange processes in Task Manager either. After some failed commands (same error), I found a workaround for this issue.