473,385 Members | 1,427 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,385 software developers and data experts.

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", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly) = Windows.Forms.DialogResult.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.Focus()
, this does nothing.

Am I missing something in my closing / disposing ?

Thanks

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

CM

"Miro" <mi******@golden.netwrote in message
news:OH**************@TK2MSFTNGP04.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", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly) = Windows.Forms.DialogResult.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.Focus() , 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 DefaultDesktopOnly Parm.
-The program was doing exactly what I told it to do, not what I wanted it to
do. ;)

Miro

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


"Charles May" <nu***@bidniz.comwrote in message
news:FMqwh.13774$yB5.8045@trndny03...
Not sure what the DefaultDesktopOnly does (didn't read up on it) but if
you take out that option it appears to work.

CM

"Miro" <mi******@golden.netwrote in message
news:OH**************@TK2MSFTNGP04.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", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly) = Windows.Forms.DialogResult.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.Focus()
, this does nothing.

Am I missing something in my closing / disposing ?

Thanks

Miro


Feb 1 '07 #3
Great, Glad it worked.
"Miro" <mi******@golden.netwrote in message
news:eB**************@TK2MSFTNGP05.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 DefaultDesktopOnly Parm.
-The program was doing exactly what I told it to do, not what I wanted it
to do. ;)

Miro

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


"Charles May" <nu***@bidniz.comwrote in message
news:FMqwh.13774$yB5.8045@trndny03...
>Not sure what the DefaultDesktopOnly does (didn't read up on it) but if
you take out that option it appears to work.

CM

"Miro" <mi******@golden.netwrote in message
news:OH**************@TK2MSFTNGP04.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", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly) = Windows.Forms.DialogResult.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.Focus()
, 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
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.....
2
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...
13
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 .......
2
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...
0
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...
4
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,...
4
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...
19
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...
6
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...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.