944,022 Members | Top Members by Rank

Ad:
Nov 11th, 2009
0

Open a form in a new window?

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cooldude9509 is offline Offline
2 posts
since Nov 2009
Nov 11th, 2009
1
Re: Open a form in a new window?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Dim F As Form
  3. Set F = New Form1
  4. F.Show
  5. End Sub



Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Dec 29th, 2009
0
Re: Open a form in a new window?
Click to Expand / Collapse  Quote originally posted by vb5prgrmr ...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Dim F As Form
  3. Set F = New Form1
  4. F.Show
  5. End Sub



Good Luck
Thank you.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cooldude9509 is offline Offline
2 posts
since Nov 2009
Jan 20th, 2010
0
Re: Open a form in a new window?
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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
murdock68 is offline Offline
1 posts
since Jan 2010
Jan 21st, 2010
0
Re: Open a form in a new window?
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...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2. Dim F As Form
  3. Set F = New Form1
  4. F.PublicProcedureName("TIMEONLY")
  5. F.Show
  6. 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...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Me.TimeDisplay = SomeNewValue
  2. 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
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Code with each new spreadsheet
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Database Manipulation!!!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC