You need to make sure that System.Drawing.dll is referenced and imported in your project.
Also, if you are going to do that, you should put all your code in the form's Paint event. Then, instead of using Me.CreateGraphics(), you use the Graphics objects passed into it. So it'd be something like this: Private Sub FormPaint(sender As Object, e As PaintEventArgs) Handles MyForm.Paint
Dim g As Graphics = e.Graphics 'the graphics object of the form is passed in the PaintEventArgs
g.FillRectangle(Brushes.Red, 10, 10, 1, 1)
End SubTo force the form to redraw, use Me.Invalidate() and the Paint event will be called. For best performance, you should never do any painting outside of the Paint event.