Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

focus goes to windows desktop after clicking on messagebox button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jan DHondt - 10 Feb 2006 08:31 GMT
Hi,

In a VS2005 app with VB.NET.

In a mdi child window I open a messagebox to ask a confirmation from the
user. After the user clicks on the yes or no button, the main application is
hidden behind all other open application windows.

this is the messagebox statement:
       If MessageBox.Show(String.Format(Me.lblConfirmDelete.Text, Me.Text,
Id.ToString), "Delete", _
                   MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1, _
                   MessageBoxOptions.DefaultDesktopOnly, False) =
Windows.Forms.DialogResult.Yes Then
           Return True
       End If
The function is called from a button click event on the mdi child windows
form, that form had the focus.

Does anyone know how to give the focus back to the mdi child window, i.e. to
my application?

Signature

Jan D''Hondt
Jade bvba
Belgium
Database and .NET development

<Toto, I''ve got a feeling we''re not in Kansas anymore.>

Jan DHondt - 10 Feb 2006 10:43 GMT
For the time being I have resolved this as follows:

I've created a windows form dialogboxstyle with yes no buttons and I've
opened this with a form.showdialog
then the main form does not get pushed back behind all other windows
applications.

But then it still does not answer my question why this happens on the
messagebox.

Signature

Jan D''Hondt
Jade bvba
Belgium
Database and .NET development

<Toto, I''ve got a feeling we''re not in Kansas anymore.>

> Hi,
>
[quoted text clipped - 18 lines]
> Does anyone know how to give the focus back to the mdi child window, i.e. to
> my application?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.