Visual Basic Reference

Visual Studio 6.0

Cls Method

See Also    Example    Applies To

Clears graphics and text generated at run time from a Form or PictureBox.



The object placeholder represents an object expression that evaluates to an object in the Applies To list. If object is omitted, the Form with the focus is assumed to be object.


Cls clears text and graphics generated at run time by graphics and printing statements. Background bitmaps set using the Picture property and controls placed on a Form at design time aren't affected by Cls. Graphics and text placed on a Form or PictureBox while the AutoRedraw property is set to True aren't affected if AutoRedraw is set to False before Cls is invoked. That is, you can maintain text and graphics on a Form or PictureBox by manipulating the AutoRedraw property of the object you're working with.

After Cls is invoked, the CurrentX and CurrentY properties of object are reset to 0.