Question was posted in VB6 section. If he's using .Net then update code accordingly. Algorithm concept stays the same.