473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to prevent firing "Leave" event on open form??

Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation?

I have a MDI form from where I call MDI child form like that:

Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()

On that child form I have some textboxes. When form show up Leave event
immediately fire in 1st textbox, but that should NOT happen in my
opinion.

Interesting is that this doesn't happen in VS 2003. Another observation
is that this doesn't happen if I open that form as non MDI child
(without "frm.MdiParent = Me" statement).

Any help or ideas how to prevent this will be very appreciated.
Regards,
Billy

Nov 21 '05 #1
15 2877
Billy,

This is the second time you ask this question and with the exact the same
text.

This is a very active newsgroup, so if somebody knows the answer you will be
answered and when it stays open some days our appreciated cleansweaper Peter
Huang will mostly search again for an answer.

When you want a quicker answer, than you can go to Microsoft support conform
the rules which exist for that.

Another approach can be to explain your problem in another way, by instance
with some code. How you create your MIDI child and what is maybe special on
your textbox.

Just my thought,

Cor

"Billy" <ab****@yahoo.com>
Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation?

I have a MDI form from where I call MDI child form like that:

Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()

On that child form I have some textboxes. When form show up Leave event
immediately fire in 1st textbox, but that should NOT happen in my
opinion.

Interesting is that this doesn't happen in VS 2003. Another observation
is that this doesn't happen if I open that form as non MDI child
(without "frm.MdiParent = Me" statement).

Any help or ideas how to prevent this will be very appreciated.
Regards,
Billy

Nov 21 '05 #2
I don't know how to explain that easier. If you create a new project,
set main form as MDI container and from there call child form like I
wrote in my first post, you just have to check if leave event fires in
1st textbox when you open that child form. Maybe is problem just on my
PC?

Nov 21 '05 #3
Billy,

Did you do this test yourself with a *new* project, when not try it and tell
me the result?
\\\form1
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.IsMdiContainer = True
Dim frm As New Form2
frm.MdiParent = Me
frm.Show()
End Sub
///
\\\form2
Private Sub TextBox1_Leave(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles TextBox1.Leave
MessageBox.Show("Hello I am leaved")
End Sub
///
I hope this helps?

Cor
I don't know how to explain that easier. If you create a new project,
set main form as MDI container and from there call child form like I
wrote in my first post, you just have to check if leave event fires in
1st textbox when you open that child form. Maybe is problem just on my
PC?

Nov 21 '05 #4
I tried on brand new project. It's working if you open form2 with
Form1_Load event like you give example. But it won't work if you call
over menu or button later when main form is already displayed. Does it
work on your PC if you call form2 over menu?

Nov 21 '05 #5
Billy,

Private Sub Form12_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.IsMdiContainer = True
Dim frm As New Form2
frm.MdiParent = Me
frm.Show()
End Sub

Private Sub MenuItem1_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles MenuItem1.Click
Dim frm As New Form2
frm.MdiParent = Me
frm.Show()
End Sub
///

In this situation is twice the same form2 showed. In that the first showed
textbox looses his focus as the second form is showed and the event fires.

This logic you cannot prevent, because it happens. However you can catch
probably this situation depending on your program in your leave event by
setting a kind of switch. You can as well set the handlers programmicly,
however in your situation I would just do it with a switch

I hope this helps?

Cor

"Billy" <ab****@yahoo.com>
I tried on brand new project. It's working if you open form2 with
Form1_Load event like you give example. But it won't work if you call
over menu or button later when main form is already displayed. Does it
work on your PC if you call form2 over menu?

Nov 21 '05 #6
I think that this has to be a bug then, becuase if you will open form
over menu for example not as child (without frm.MdiParent = Me) then
Leave will not fire.

Regards,
Billy

Nov 21 '05 #7
Billy,

I agree, I think that it is the best that you get as quick as possible that
bug from your program.

Cor

"Billy" <ab****@yahoo.com>
I think that this has to be a bug then, becuase if you will open form
over menu for example not as child (without frm.MdiParent = Me) then
Leave will not fire.

Regards,
Billy

Nov 21 '05 #8
How you mean bug from my program? Do you say that "Leave" not fire in
your application if you open child form2 over menu or you joking from
from my problem?

If "Leave" fire with that call:
Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()

But not fire with that call (what is correct for Leave):
Dim frm As New frmChild()
frm.Show()

Then I missed something in my code. Can you tell me what?

Nov 21 '05 #9
Billy,

In the sample I gave you it *should* fire.

To give you an other sample, maybe you understand it than.
In this sample it will not fire the first time one the menuclick. However
when without doing something else the second time the mouse button is
clicked, it *should* fire for the form created with the first click or when
that MDI form is closed. When you do this with a normal form, that form does
not loose focus when the button is again clicked (but should when it
closes).

\\\
Private Sub Form12_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.IsMdiContainer = True
End Sub

Private Sub MenuItem1_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles MenuItem1.Click
Dim frm As New Form13
frm.MdiParent = Me
frm.Show()
End Sub
///.

I hope this makes it more clear,

Cor
"Billy" <ab****@yahoo.com>
How you mean bug from my program? Do you say that "Leave" not fire in
your application if you open child form2 over menu or you joking from
from my problem?

If "Leave" fire with that call:
Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()

But not fire with that call (what is correct for Leave):
Dim frm As New frmChild()
frm.Show()

Then I missed something in my code. Can you tell me what?

Nov 21 '05 #10
Billy,
Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation? Interesting is that this doesn't happen in VS 2003.
I don't know specifically, if it occurs in .NET 1.0 (VS2002) & not in .NET
1.1 (VS2003), then that would be a good indication that a bug was fixed!
Would it not?

I would "overcome the situation" by upgrading to VS.NET 2003, especially if
you have already demonstrated to yourself that the problem is resolved in
VS2003!

Remember 2003 fixed a number of bugs in the IDE, made a number of
performance improvements in the IDE, plus .NET 1.1 fixed a number of bugs
from .NET 1.0. .NET 1.1 SP1 fixed a number of bugs in the framework, plus
added a couple of handy options...

In fact I would recommend you upgrade all the way to VS.NET 2002 w/.NET 1.1
SP1.

Hope this helps
Jay

"Billy" <ab****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation?

I have a MDI form from where I call MDI child form like that:

Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()

On that child form I have some textboxes. When form show up Leave event
immediately fire in 1st textbox, but that should NOT happen in my
opinion.

Interesting is that this doesn't happen in VS 2003. Another observation
is that this doesn't happen if I open that form as non MDI child
(without "frm.MdiParent = Me" statement).

Any help or ideas how to prevent this will be very appreciated.
Regards,
Billy

Nov 21 '05 #11
> In fact I would recommend you upgrade all the way to VS.NET 2003 w/.NET
1.1 SP1.
:)

Wonder why everybody didn't upgrade to VS 2003 (from 2002) when MS was
practically giving it away for $25? Better question: why did MS stop
offering the upgrade price???

Greg
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl... Billy,
Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation?

Interesting is that this doesn't happen in VS 2003.


I don't know specifically, if it occurs in .NET 1.0 (VS2002) & not in .NET
1.1 (VS2003), then that would be a good indication that a bug was fixed!
Would it not?

I would "overcome the situation" by upgrading to VS.NET 2003, especially
if you have already demonstrated to yourself that the problem is resolved
in VS2003!

Remember 2003 fixed a number of bugs in the IDE, made a number of
performance improvements in the IDE, plus .NET 1.1 fixed a number of bugs
from .NET 1.0. .NET 1.1 SP1 fixed a number of bugs in the framework, plus
added a couple of handy options...

In fact I would recommend you upgrade all the way to VS.NET 2002 w/.NET
1.1 SP1.

Hope this helps
Jay

"Billy" <ab****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation?

I have a MDI form from where I call MDI child form like that:

Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()

On that child form I have some textboxes. When form show up Leave event
immediately fire in 1st textbox, but that should NOT happen in my
opinion.

Interesting is that this doesn't happen in VS 2003. Another observation
is that this doesn't happen if I open that form as non MDI child
(without "frm.MdiParent = Me" statement).

Any help or ideas how to prevent this will be very appreciated.
Regards,
Billy


Nov 21 '05 #12
Greg,
Wonder why everybody didn't upgrade to VS 2003 (from 2002) when MS was
practically giving it away for $25? I'm really not sure. I got the upgrade as part of my MSDN Universal
subscription...

I suspect its the "programming by rut" syndrome a number of developers have.
:-|
Better question: why did MS stop offering the upgrade price???

I really don't know, however I suspect it was a promotional gimmick in an
attempt to get people to upgrade...

Just a thought
Jay

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:eo**************@TK2MSFTNGP11.phx.gbl...
In fact I would recommend you upgrade all the way to VS.NET 2003 w/.NET
1.1 SP1.


:)

Wonder why everybody didn't upgrade to VS 2003 (from 2002) when MS was
practically giving it away for $25? Better question: why did MS stop
offering the upgrade price???

Greg
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Billy,
Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation?

Interesting is that this doesn't happen in VS 2003.


I don't know specifically, if it occurs in .NET 1.0 (VS2002) & not in
.NET 1.1 (VS2003), then that would be a good indication that a bug was
fixed! Would it not?

I would "overcome the situation" by upgrading to VS.NET 2003, especially
if you have already demonstrated to yourself that the problem is resolved
in VS2003!

Remember 2003 fixed a number of bugs in the IDE, made a number of
performance improvements in the IDE, plus .NET 1.1 fixed a number of bugs
from .NET 1.0. .NET 1.1 SP1 fixed a number of bugs in the framework, plus
added a couple of handy options...

In fact I would recommend you upgrade all the way to VS.NET 2002 w/.NET
1.1 SP1.

Hope this helps
Jay

"Billy" <ab****@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Anyone know if this a bug in VB.NET 2002 and how to overcame that
situation?

I have a MDI form from where I call MDI child form like that:

Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()

On that child form I have some textboxes. When form show up Leave event
immediately fire in 1st textbox, but that should NOT happen in my
opinion.

Interesting is that this doesn't happen in VS 2003. Another observation
is that this doesn't happen if I open that form as non MDI child
(without "frm.MdiParent = Me" statement).

Any help or ideas how to prevent this will be very appreciated.
Regards,
Billy



Nov 21 '05 #13
Greg,

Was it maybe because that it was a limited offer only for the USA and
Canada.

I remember me some very interesting discussions in this newsgroup from that
time, that I personally miss at the moment a little bit.

http://groups-beta.google.com/group/...e4f92f9f3005f4

http://groups-beta.google.com/group/...35e2f16c9643be

:-))

Cor
Nov 21 '05 #14
"Cor Ligthert" <no************@planet.nl> wrote in message
Was it maybe because that it was a limited offer only for the USA and
Canada.


Ah, did not know that. VS 2003 felt so much like a point release. I don't
understand why MS charges for the upgrade.

Greg

Nov 21 '05 #15
Thank you for your replay Jay and also to all other, special to you
Cor. I agree that the easiest will be just upgrade to 2003, but
customer wanted that in 2002 when started and because of that I was
looking for some kind solution in 2002.

Regards,
Billy

Nov 21 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AussieRules | last post by:
Hi, I have a form with many textbox on it. Behind this(so to speak), is a class, and each time the user changes the value of the text box I want to update the relevant property of the class. ...
0
by: Billy | last post by:
Anyone know if this a bug in VB.NET 2002 and how to overcame that situation? I have a MDI form from where I call MDI child form like that: Dim frm As New frmChild() frm.MdiParent = Me...
3
by: William E Voorhees | last post by:
I have code (using the leave event) in a textbox which prevents the user from leaving the box if it is blank. I would like the user to be able to click on the button of the form and close that...
3
by: Jeff Jarrell | last post by:
I have one textbox on a form. Nothing else. The validate event doesn't fire. Drop another textbox on the form and the validate event fires. Set tabstop = false on the 2nd text box and the...
3
by: mtczx232 | last post by:
I have TabControls that Hold Forms on his TabPges (this make me easy to give ability to Designing each form in his IDE window). When form x is in middle of Edit Data Mode, I going to prevent:...
11
by: LionelAndJen | last post by:
I have an XML file that has a comment field in which the data provider, very kindly, already uses "&quot;" when writing "doesn't", I have doesn&apos;t . it's PERFECT, because that xml is then fed to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.