Avatar of Rahamathulla_J
Rahamathulla_J

asked on 

messagebox display in taskbar

//Rahamath
                                    this.btnAddRecord.Location = new System.Drawing.Point(416, 304);


this.btnEditAuthenticate.Location = new System.Drawing.Point(252, 304)

I my winform application after the form loads it will populate a message box using thread for user input (Ok/Cancel). It is working fine. The problem is the message box directly loaded in the taskbar so the user has to click that tab from the panel to see the message box in the center screen. The new user may not aware of that the appliation need a user input.

I want to show the message box in the center screen instead in the taskbar how can i do this? and what is the problem.
C#Programming Languages-Other

Avatar of undefined
Last Comment
jinn_hnnl
Avatar of Adecus
Adecus

To display a messagebox on a form so it is modal to that form you must hand in the form object to the messagebox show call:

MessageBox.Show(FormObject, "MyMessage");

In your case, I think you will have the code:

MessageBox.Show(this, "MyMessage");

-Adecus
Avatar of Adecus
Adecus

If this did not solve your problem, post the code that you're using right now to display the message box.
Avatar of Adecus
Adecus

Also, if you want the form to be focussed to the user immediately you can use the code:
this.Activate();
MessageBox.Show(this, "MyMessage");
Avatar of Rahamathulla_J

ASKER

Hi Adecus,

I tried your idea
MessageBox.Show(this, "MyMessage");

the message box coming behind the main form screen. What is the problem? I hope this is the problem with the running of 2 threads. 1 main thread and 1 thread for the Messagebox
ASKER CERTIFIED SOLUTION
Avatar of jinn_hnnl
jinn_hnnl
Flag of Netherlands image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo