Opening form invisible

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Is there a way to open a form hidden/invisible while it is populating its
controls, and then make it visible once it is done? I am using the following
code but the form remains visible.

cform = New frmClients
cform.Visible = False ' this does not seem to make form hidden (not
visible)
cform.TopLevel = False
Me.FormsPanel.Controls.Add(cform) 'Me is a main/parent form
cform.Show()
cform.BringToFront()
cform.Visible = True

Thanks

Regards
 
Hi John,

When you do your loading in the "load" event from the form, it is invisible
untill that is ready. The first event with a visible form I use is the form
activated.

I hope this helps?

Cor
 
* "John said:
Is there a way to open a form hidden/invisible while it is populating its
controls, and then make it visible once it is done? I am using the following
code but the form remains visible.

cform = New frmClients
cform.Visible = False ' this does not seem to make form hidden (not
visible)
cform.TopLevel = False
Me.FormsPanel.Controls.Add(cform) 'Me is a main/parent form

The form will remain invisible until the execution of the next line.
cform.Show()
cform.BringToFront()
cform.Visible = True

The last line doesn't make sense because the form is already visible.
 
The problem is that I see the controls being painted one by one. Can I not
keep the form hidden until all controls are painted during the first form
loading?

Thanks

Regards
 
The problem is that I see the controls being painted one by one. Can I not
keep the form hidden until all controls are painted during the first form
loading?

Thanks

Regards
 
* "John said:
The problem is that I see the controls being painted one by one. Can I not
keep the form hidden until all controls are painted during the first form
loading?

Google for 'SendMessage' + 'WM_SETREDRAW', maybe this will work for you.
 
Private Sub CreateForm_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

' mhf is a form declared at class level

mhf.Visible = False

For x As Integer = 0 To 20

mhf.Controls.Add(New Windows.Forms.Button)

Next

End Sub

Private Sub MakeVisible_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

mhf.Visible = True

End Sub

End Class
 
Back
Top