Tiger2345
asked on
Form showing
I am trying to create a form to print, i have set the visibility to false on the formload & on the properties,
But it still shows, i have even tried to disenable it but it still F*****k shows
HELP!!!!
But it still shows, i have even tried to disenable it but it still F*****k shows
HELP!!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you have to make it invisible in any case after it has been called with the show method, you can:
show and make infisible after ie:
'in form1
Form2.Show
Form2.Visible = False
'or, in form2:
'code it in the resize event:
Private Sub Form_Resize()
Me.Visible = False
End Sub
'Or even:
'put a timer enabled, intervak 50 msec.
'in timer event code:
Private sub Timer1_Timer()
Timer1.enabled = False
me.visible = False
end sub
Point is: the load event occurs before form is completely shown, thus, as last command of the Show method make your form visible, if you want to set it as invisible, you have to do it after the load event completed.
show and make infisible after ie:
'in form1
Form2.Show
Form2.Visible = False
'or, in form2:
'code it in the resize event:
Private Sub Form_Resize()
Me.Visible = False
End Sub
'Or even:
'put a timer enabled, intervak 50 msec.
'in timer event code:
Private sub Timer1_Timer()
Timer1.enabled = False
me.visible = False
end sub
Point is: the load event occurs before form is completely shown, thus, as last command of the Show method make your form visible, if you want to set it as invisible, you have to do it after the load event completed.
If you don't want to show on process tab on task manager
then paste the following code on your form
Option Explicit
' hide window from task manager
Const SW_HIDE = 0
Const GW_OWNER = 4
'Window always on top
Const SWP_NOACTIVATE = &H10
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Sub Form_Load()
On Error Resume Next
ShowWindow GetWindow(hwnd, GW_OWNER), SW_HIDE
SetWindowPos hwnd, -1, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
End Sub