VB example code ported from CS