bizzare me.close() problem

  • Thread starter Thread starter Mike Fellows
  • Start date Start date
M

Mike Fellows

I have a windows form with a tabcontrol on it

within each tabpage there is a button that does basically the same thing
except with the difference of one variable

at the end of each of the button.click sub i run me.close()

me.close() works on 2 of the 3 buttons with no problems

on one of the forms it leaves the windows form open, even though when
debugging it is running the me.close command

here is my button click code (and me.close() is definatley executed)

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button12.Click
Dim telephone As Boolean
Dim repname As String = Me.ComboBox1.Text.ToString
Dim rating As String = Me.ComboBox6.Text.ToString
If rating = "6. No Telephone" Then
telephone = False
Else
telephone = True
End If
Dim telchk As String = ComboBox5.Text.ToString
Dim yesno As String = "NULL"
Dim try1 As String = Me.Label16.Text.ToString
Dim try2 As String = Me.Label26.Text.ToString
Dim try3 As String = Me.Label19.Text.ToString
Dim councilrtb As String = Me.DateTimePicker1.Text.ToString
Dim team As String = Me.ComboBox4.Text.ToString
If telephone = True Then
RaiseEvent MyEvent(repname, rating, telchk, yesno, try1, try2, try3,
councilrtb, team, "Live")
Else
RaiseEvent MyEvent(repname, rating, telchk, yesno, try1, try2, try3,
councilrtb, team, "Live (No Tel)")
End If
Me.Close()
 
Strange....or maybe not ?

I set up three tabs ( no events mind ) and put three buttons on, one on each
with me.Close() in it. only the first tab button will close the form.


Hmmmm....
 
why not make a sub procedure containing the "shutdown instructions an
me.close" and then call it in whichever click event?

I do the same thing to keep from having redundant code, That way i can call
shutdown & close from wherever. Not sure if it is good or bad practice.
haven't tried this way, but if you make a shared procedure with me.close in
it couldn't you call that from any form?
 
TabPage1.FindForm.Close()

One Handed Man said:
Strange....or maybe not ?

I set up three tabs ( no events mind ) and put three buttons on, one on each
with me.Close() in it. only the first tab button will close the form.


Hmmmm....
 
Yes, thats true, cant deny it. But I'm still wondering why the me.close()
method does not close the form in any other tabs beside tab1 ?
 
Hello,

Mike Fellows said:
I have a windows form with a tabcontrol on it

within each tabpage there is a button that does basically the same thing
except with the difference of one variable

at the end of each of the button.click sub i run me.close()

me.close() works on 2 of the 3 buttons with no problems

on one of the forms it leaves the windows form open, even though when
debugging it is running the me.close command

here is my button click code (and me.close() is definatley executed)

I am not able to repro that on Windows XP, .NET 1.1. Maybe this is
caused by the "close bug" in .NET 1.0. Which version of .NET do you
use?
 
Thanks Guys ive managed to get it sorted, its just bizarre how two of the
three worked and the other didnt
 
Back
Top