473,761 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Lost Focus

VB 2005 Express.

I have an MDI app, and I have a child form loading in the Parent form.
On the Child form I have a command button "Close". Upon click of that
close,

If MessageBox.Show ("Are you sure you want to cancel?", _
"Cancel", _
MessageBoxButto ns.YesNo, _
MessageBoxIcon. Question, _
MessageBoxDefau ltButton.Button 1,
MessageBoxOptio ns.DefaultDeskt opOnly) = Windows.Forms.D ialogResult.Yes Then
Me.Close()
Me.Dispose()
End If

This works proper... however I loose focus to the Entire Application.
Even when I try to put something like this after it: frmMainForm.Foc us()
, this does nothing.

Am I missing something in my closing / disposing ?

Thanks

Miro
Feb 1 '07 #1
3 3125
Not sure what the DefaultDesktopO nly does (didn't read up on it) but if you
take out that option it appears to work.

CM

"Miro" <mi******@golde n.netwrote in message
news:OH******** ******@TK2MSFTN GP04.phx.gbl...
VB 2005 Express.

I have an MDI app, and I have a child form loading in the Parent form.
On the Child form I have a command button "Close". Upon click of that
close,

If MessageBox.Show ("Are you sure you want to cancel?", _
"Cancel", _
MessageBoxButto ns.YesNo, _
MessageBoxIcon. Question, _
MessageBoxDefau ltButton.Button 1,
MessageBoxOptio ns.DefaultDeskt opOnly) = Windows.Forms.D ialogResult.Yes
Then
Me.Close()
Me.Dispose()
End If

This works proper... however I loose focus to the Entire Application.
Even when I try to put something like this after it:
frmMainForm.Foc us() , this does nothing.

Am I missing something in my closing / disposing ?

Thanks

Miro

Feb 1 '07 #2
Learn something new every day.

I thought it was more with my disposing and closing or some property I had
set on the form rather than the messagebox itself.
That will teach me to always start at the "very beginning" of the problem.

Thank you CM,

It makes sense once I read up on the DefaultDesktopO nly Parm.
-The program was doing exactly what I told it to do, not what I wanted it to
do. ;)

Miro

---
DefaultDesktopO nly
The message box is displayed on the active desktop.
This constant is the same as ServiceNotifica tion except that the system
displays the message box only on the default desktop of the interactive
window station.
---


"Charles May" <nu***@bidniz.c omwrote in message
news:FMqwh.1377 4$yB5.8045@trnd ny03...
Not sure what the DefaultDesktopO nly does (didn't read up on it) but if
you take out that option it appears to work.

CM

"Miro" <mi******@golde n.netwrote in message
news:OH******** ******@TK2MSFTN GP04.phx.gbl...
>VB 2005 Express.

I have an MDI app, and I have a child form loading in the Parent form.
On the Child form I have a command button "Close". Upon click of that
close,

If MessageBox.Show ("Are you sure you want to cancel?", _
"Cancel", _
MessageBoxButto ns.YesNo, _
MessageBoxIcon. Question, _
MessageBoxDefau ltButton.Button 1,
MessageBoxOpti ons.DefaultDesk topOnly) = Windows.Forms.D ialogResult.Yes
Then
Me.Close()
Me.Dispose()
End If

This works proper... however I loose focus to the Entire Application.
Even when I try to put something like this after it: frmMainForm.Foc us()
, this does nothing.

Am I missing something in my closing / disposing ?

Thanks

Miro


Feb 1 '07 #3
Great, Glad it worked.
"Miro" <mi******@golde n.netwrote in message
news:eB******** ******@TK2MSFTN GP05.phx.gbl...
Learn something new every day.

I thought it was more with my disposing and closing or some property I had
set on the form rather than the messagebox itself.
That will teach me to always start at the "very beginning" of the problem.

Thank you CM,

It makes sense once I read up on the DefaultDesktopO nly Parm.
-The program was doing exactly what I told it to do, not what I wanted it
to do. ;)

Miro

---
DefaultDesktopO nly
The message box is displayed on the active desktop.
This constant is the same as ServiceNotifica tion except that the system
displays the message box only on the default desktop of the interactive
window station.
---


"Charles May" <nu***@bidniz.c omwrote in message
news:FMqwh.1377 4$yB5.8045@trnd ny03...
>Not sure what the DefaultDesktopO nly does (didn't read up on it) but if
you take out that option it appears to work.

CM

"Miro" <mi******@golde n.netwrote in message
news:OH******* *******@TK2MSFT NGP04.phx.gbl.. .
>>VB 2005 Express.

I have an MDI app, and I have a child form loading in the Parent form.
On the Child form I have a command button "Close". Upon click of that
close,

If MessageBox.Show ("Are you sure you want to cancel?", _
"Cancel", _
MessageBoxButto ns.YesNo, _
MessageBoxIcon. Question, _
MessageBoxDefau ltButton.Button 1,
MessageBoxOpt ions.DefaultDes ktopOnly) = Windows.Forms.D ialogResult.Yes
Then
Me.Close()
Me.Dispose()
End If

This works proper... however I loose focus to the Entire Application.
Even when I try to put something like this after it: frmMainForm.Foc us()
, this does nothing.

Am I missing something in my closing / disposing ?

Thanks

Miro



Feb 1 '07 #4

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

Similar topics

3
1429
by: Carl | last post by:
Hi, I have a from called frmBatchUpdate. On it I have created 10 text boxes in one column txtTRN1, txtTRN2 etc.. (Tenancy Reference Numbers) and another 10 to the right txtRPA1, txtRPA2 etc.. (RegularPaymentAmount) and one on it's own txtNewRPA. The left hand column is there to allow a user to enter a Tenancy Reference Number and when the focus is lost, the text box to the right of it displays the Regular Rent payment for that tenant.
2
3762
by: Mark Ingram | last post by:
Hi, ive just had to make a Find dialog for an application and to get it in a similar style to the MS ones i have had to set the control style to TopMost so that i can move the caret around whilst the find dialog is open. However i want to know when i lose the focus, if it ISNT the form that called my find dialog, i want to change the topmost style to a normal style so that it wont be displayed on top of the other form. Does that make...
13
3612
by: M O J O | last post by:
Hi, I need to create a popup form what will not steal focus. I've searched the net and I managed to put some code together. Below is the result of my code, but I have a single question .... how can I prevent form2 to show in taskbar? I've tried to set the ShowInTaskBar to false, but then an exception is thrown. Here's my code:
2
1045
by: ghobley | last post by:
Hello, My application has 2 forms on display at one time. The form on the left contains a tree view which drives the contents of the form on the right. My problem is that I would like to capture the event that occurs when you enter text in a field on the main form and then click on the other form without tabbing or clicking other fields on the from. What Event is triggered in this instance I need to capture this event and obtain the text...
0
1714
by: Nick | last post by:
I have a situation wherein i have a text box, that has abc() being executed whenever the lost focus event is triggered. However, there is an exceptional case where, if a button click causes the lost focus, I do not want abc() to be called. Is there a method by which one can find out which control is triggering the lost focus event? I have a keyboard shortcut for the click handle, and the lost focus handle does not get invoked if I use...
4
2481
by: easoftware | last post by:
I am using VS .Net 2003 and VB. I have an app with one parent and two Mdi child forms. I need to validate data in the Mdi form. The Form.Validating event works when I try to close a Mdi form, but not when I try to switch form one Mdi form to the other. I tried to add code to MdiForm1's Deactivate event: Private Sub MidForm1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Deactivate Dim TempE As...
4
1668
by: vandanasridhar | last post by:
Hi, its Vandana. I m a begginer of VB, Trying to create a form Having three command buttons Add, Modify, Exit. I made coding & it is running well, but technically not very sound. I use lost focus event of text box to get data while modifying the record. this event will give me complete detail of record if exist or give me other textboxes blank if no data found. all is going well. But if i wanna Exiting my form after entering the key, i need to...
19
3226
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But these Validating Events are also fired when either the child form or the main (parent) form Close icon is clicked. And I need for these events to know if they are being invoked because the app (or child window) is being closed. I have set a boolean...
6
13244
tuxalot
by: tuxalot | last post by:
braindead here...can't find a resolution to what should be a silly issue. I have a pop-up calendar form that I wish to close when the user clicks back on the main form of my app. I've tried deactivate, lost focus, got focus on the main form all to no avail. Any help is much appreciated. Tux
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.