Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy > > >

VB window is reopening itself?


(!)

breebreebran's Avatar
breebreebran breebreebran is offline
Member with 1 posts.
THREAD STARTER
 
Join Date: Jul 2012
Experience: Intermediate
09-Jul-2012, 07:04 AM #1
VB window is reopening itself?
I'm making a desktop GUI with VB. When I click button1 on Window1, it opens up a new window. I have window 1 window 2 and window 3. On window 2, when a progress bar gets to 100% it opens up window 3. But when the window3 opens I dont need window 2 open anymore. So I close out Window 2 but it just comes back up. Any ideas?

Window1(Members.class)
Code:
PublicClass Members
 
 
 
 
 
PrivateSub ToolStripStatusLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
EndSub
PrivateSub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Start()
ProgressBar1.Increment(1)
If ProgressBar1.Value = 100 Then
Members2.Show()
EndIf
 
 
 
 
 
EndSub
PrivateSub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
ProgressBar1.Value = 100
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
EndSub
PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
EndSub
PrivateSub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
RichTextBox1.HideSelection = False
Dim i AsDouble
For i = 0 To RichTextBox1.Text.Length Step 5 ' change this to adjust the speed of the scroll. The higher the number the faster the scroll.
RichTextBox1.SelectionStart = i 'RichTextBox1.Text.Length
Next
EndSub
EndClass
Window 2(Members2.class)

Code:
PublicClass Members2
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Members3.ShowDialog()
 
 
EndSub
PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
EndSub
EndClass
Window3(Members3.class)

Code:
PublicClass Members3
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
Members2.Close()
Member1.Close()
 
 
 
 
EndSub
EndClass
But Members2 wont close.
It closes for a second and then it comes right back up.
How do I fix this?
Also, if you saw my richtextbox autoscroll in Members1, that doesnt work either. Any idea why that isnt working?




EDIT:
When I add a stop to Timer1 in Members.class the problem stops.
But when I stop the timer the progress bar wont increase so the new window wont open.

Last edited by breebreebran; 09-Jul-2012 at 10:41 AM..
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 5,242 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
10-Jul-2012, 10:05 AM #2
I'm not quite sure what you're trying to do here, but my suggestion is that you disable the timer after you show Members2.

Code:
If ProgressBar1.Value = 100 Then
Members2.Show()
Timer1.Stop()
EndIf
You could also use Enabled = false instead of Stop()


Meanwhile, you really shouldn't need the line Timer1.Start(), if the timer hadn't already started you couldn't be running that bit of code anyway!

Last edited by Ent; 10-Jul-2012 at 10:10 AM..
SpectresShadow's Avatar
SpectresShadow   (Josh) SpectresShadow is offline
Computer Specs
Member with 121 posts.
 
Join Date: Aug 2012
Location: Waupaca
Experience: Intermediate
04-Aug-2012, 02:44 PM #3
Try closing window 1 and window 2 before closing window 3

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Members2.Close()
      Members1.Close()
      Me.Close()
End Sub
If this doesn't work then maybe try to close each window when a new one opens

Code:
Private Sub Button1_Click(ByVal sender As System.Objec, ByVal e As System.EventArgs) Handles Button1.Click
     Members2.Show()
     Me.Close()
End Sub
Hope this helps
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑