Click here to Skip to main content
15,397,084 members
Please Sign up or sign in to vote.
1.22/5 (4 votes)
See more:
While i deploy my application...Again error....
Anybbody help and solve this problem......
Here my code...

DialogResult result = TopMostMessageBox.Show("Your Password will Expire in" + 
                      " " + Futdays + " " + "Day(s)" + "\n" + "Do you want Change it now?", 
                      "Financial Management System",
static public DialogResult Show(string message, 
                                string title,
                                MessageBoxButtons buttons, 
                                MessageBoxIcon Icon,
                                MessageBoxDefaultButton Btn,
                                MessageBoxOptions Opt)
    Form topmostForm = new Form();
    topmostForm.Size = new System.Drawing.Size(1, 1);
    topmostForm.StartPosition = FormStartPosition.Manual;
    System.Drawing.Rectangle rect = SystemInformation.VirtualScreen;
    topmostForm.Location = new System.Drawing.Point(rect.Bottom + 10, rect.Right + 10);
    topmostForm.TopMost = true;
    DialogResult result = MessageBox.Show(topmostForm, message, title,buttons,Icon,Btn,opt)  //------->Error appeared here,i mentioned below   topmostForm.Dispose();
    return result;

now Servive notification error corrected. but below error appered.

<br />
Show a service notification messagebox with an owner window is not a valid operation. Use the show method that does not take an owner. Parameter name:options<br />
Updated 7-Feb-11 17:35pm
TweakBird 7-Feb-11 6:51am
I am unable fix formatting, Can you edit your question & Update it.
P.S: Please un check Ignore HTML check box & Post it again.
RaviRanjanKr 7-Feb-11 7:14am
Please update your question to make it readability.
Richard MacCutchan 7-Feb-11 7:30am

I think the error message is quite clear about what you are doing wrong. You just need to use the correct form of MessageBox.Show().

It also helps if you use copy and paste to add error messages to your post, rather than typing your interpretation of it.
Good point, a 5.
Why don't you change this line:

DialogResult result = TopMostMessageBox.Show("Your Password will Expire in" +
                                             " " + Futdays + " " + "Day(s)" + "\n" + 
                                             "Do you want Change it now?", 

to real like this:

DialogResult result = TopMostMessageBox.Show(string.Format("Your Password will Expire in {0} Day(s).\nDo you want Change it now?", Futdays),

It's much more efficient...
Agreed, a 5
John, it is not much more sufficient. The compiler is smart enough to convert all of those consecutive strings literals to just one string in IL. (Without any runtime concatenation cost)

That means the original code is only concatinating three strings. Of course the String.Format() is still probably a better way to go, but not much more efficient.
Dave Kreskowiak 27-Apr-12 18:02pm
It's much more efficient to bebug the String.Format version than the OP's version.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900