Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CLS CLEAR SCREEN COMMAND

Status
Not open for further replies.

jankoch

Programmer
Jan 3, 2002
1
DE
Hi,

I am a VB Newbie, I am used to QB.
So, how do I clear the screen ?
CLS ? Doesn't work. Got a form full
of stuff and would like to clear it to continue
with the program

Thanks,

Jan
 
Hi Jan, could you give a bit more information.

When you say "a form full of stuff", what sort
of stuff do you mean.

Do you want to clear all the controls from the form?
Or do you just want to remove data from inside controls
e.g. emptying text from text boxes.

Please describe your form and what you want to clear.

:)
 
Hi I am not sure what u exactly want. I have two suggestions(methods)

Method one:
----------------
To hide all the controls on the form u can call this sub routine clear

Public Sub clear()
Dim obj As Object
On Error Resume Next
For Each obj In Me
obj.Visible = False
Next
End Sub

Method 2:
--------------

This is straight from the MSDN

Cls Method Example

This example uses the Cls method to delete printed information from a form. To try this example, paste the code into the Declarations section of a form, and then press F5 and click the form.

Private Sub Form_Click ()
Dim Msg ' Declare variable.
AutoRedraw = -1 ' Turn on AutoRedraw.
ForeColor = QBColor(15) ' Set foreground to white.
BackColor = QBColor(1) ' Set background to blue.
FillStyle = 7 ' Set diagonal crosshatch.
Line (0, 0)-(ScaleWidth, ScaleHeight), , B ' Put box on form.
Msg = "This is information printed on the form background."
CurrentX = ScaleWidth / 2 - TextWidth(Msg) / 2 ' Set X position.
CurrentY = 2 * TextHeight(Msg) ' Set Y position.
Print Msg ' Print message to form.
Msg = "Choose OK to clear the information and background "
Msg = Msg & "pattern just displayed on the form."
MsgBox Msg ' Display message.
Cls ' Clear form background.
End Sub

Hope this helps
Murali Bala
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top