I'm new here at DaniWeb, and my english suck.
Does anybody know how to make a form open itself, just in a new window? I want to make a form, that haves a button in it. when i click the button, it opens up a "copy" of itself (the old window is still open). i know it sounds stupid, but i'm new to vb6. any help please? thank you.

Private Sub Command1_Click()
Dim F As Form
Set F = New Form1
F.Show
End Sub

Good Luck

Thank you.

This helped me a lot too, thank you!

But I have another question about this, in my first Form are a couple timers running, and i want them to see them counting in the second screen too...


i'll explain the use : My first form shall contain a scoreboard for a paintball game for the referees, the extra screens i want to open should just show the score and time info, as it is running on the main form...

thanks in advance!

murdock68,

Raising the dead around here will get you labeled a necrophiliac. So next time you need to reference an older/dead thread in your NEW thread, copy its URL into your post.

As for you question, you will need to build a public procedure to pass instructions to. Meaning, lets say that everything you have built is in form1, so you use the above code to instantiate a second copy of form1 but only want to show the time display in this new form1. So you would make a call to this public procedure when you create the form...

Private Sub Command1_Click()
Dim F As Form
Set F = New Form1
F.PublicProcedureName("TIMEONLY")
F.Show
End Sub

and inside this public procedure you would set up the form to show only the timer you want.

However, doing it this way will cause you problems because of the single threaded nature of classic Visual Basic 6.0 because only one timer event will fire at a time. So while your main forms time may change from 5:58 to 5:57, the second form will not change until the main form is done processing. So you could end up with one form with a time of 5:57 and the other form displaying a time of 5:58 for a brief moment and depending upon how much processing goes on, that difference could grow from a moment to a few seconds if not more.

So, how would you rectify this you might ask? Well, you will have to control everything from one form. Which means, that when you make your call to the public procedure in the second instantation of the form, you disable the timers while you set the form up for display. This also means that you would have to move the declaration of Dim F As Form to the general declarations and you might want to also declare a boolean variable also so that you can test to see if you have shown the timer only version of your form. So then your timer code would look something like...

Me.TimeDisplay = SomeNewValue
If IsTimerOnlyFormShown = True Then TimeOnlyForm.TimeDisplay = SomeNewValue

I hope you get the meaning of this, if not. please start a new thread and copy the url of this thread into your new thread.

Good Luck

This question has already been answered. Start a new discussion instead.