If you had switched on the debugger (Program -> Build Options -> Debug Build) it would have told you that you're attempting to access a "Null" object (one that does not exsist yet) in this line:
DrawImage barsImage, 0, barPositionjust comment out the offending line (barsImage is not a valid image).