Hi and thanks.
I am wondering if there is a way to clear the screen before the program is loading.
What you mean about clear the screen? what screen?
Likes minimize all programs :
You can try this :
This use API function. It will same efect when you press "win+D" in keyboard.
Private Const KEYEVENTF_EXTENDEDKEY As Long = &H1 Private Const KEYEVENTF_KEYUP As Long = &H2 Private Const VK_LWIN As Byte = &H5B Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Public Sub ClearDesktop() ' Simulate key press Call keybd_event(VK_LWIN, 0, KEYEVENTF_EXTENDEDKEY, 0) Call keybd_event(Asc("D"), 0, 0, 0) ' Simulate key release Call keybd_event(VK_LWIN, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0) Call keybd_event(Asc("D"), 0, KEYEVENTF_KEYUP, 0) End Sub Private Sub Form_Load() ClearDesktop End Sub
private sub Form Load()
first of all here i am agree with Jx_Man's opinion
so first you should specify that what do you mean by the term Screen (is it window screen or a visual basic form ?)
And if you wanna clear the form screen then you should go with follwing code (its nothing but just using
Clsmethod with form_name)
Private Sub Form_Load() Form1.Cls End Sub
the above code will help you to clear the form screen but it will not clear the form controls, if you wanna also clear the form controls then make proper use of visible property(which can also be accessible through code).
If you are not familiar with that , then have a look at the code
Private Sub Form_Load() Form1.Cls For Each Control In Form1 Control.Visible = False Next End Sub
the above statement will hide all control when loading the form.if you wanna show all these control then you can use of visible property with value
hope this helps you to solve the issue.