C # MessageBox no longer displays the entire line of text

I'm trying to show a simple message that I've done probably thousands of times in the past and NOW ... The full line of text is NOT displayed in the MessageBox. I don't do anything differently, so I don't see the problem. Here's my code:

if (MessageBox.Show("The text in this file has changed. Do you want to save changes?",
    "TextEditor - Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{ //Do stuff 
} else { 
// Do stuff }

      

Now when the message is displayed, the only visible text is the following:

The text in this file has changed.

NOTE. Yes / No buttons are visible and the message box looks fine, it doesn't look broken or anything, so I have no idea why I can no longer show a simple dam question! .. Anyone know about this? Have you experienced this before?

thank

OK THIS VIDEO ... (EDITED)

I just changed the text for the above post text and it now displays the following:

The text in this file has changed. You wa

But the most important part of the question is still missing ...

+2


source to share


9 replies


I just solved this problem. I am using Windows XP Home Edition and also using Stardock WindowBlinds to create a 500 year old WindowsXP interface. This has never caused any problems in the past, I have been using WindowBlinds for years and also have been doing C # for about a year and a half, and this is the first time WindowBlinds has caused any problems it has ever had.

The reason why only some of the text was showing in the MessageBox is still divulging the mystery, but once I decided to try and close WindowBlinds and apply the standard XP theme again ... All MessageBoxes work correctly in C #.




Thank you for your good suggestions, which they really appreciate. : o)

Jason Pezzimenti

-1


source


A few things to try:
1) When running the debug version, try compiling and running the release version
2) Try creating a completely new project and copy the code to the new project and run it (the project setting may be changed, then you can split the files)
3) Try disabling any antivirus software you have.



+3


source


The space between "changed". and "Do" won't be some weird character (say NULL), will it? Try deleting all the text and then manually entering it again.


Hmm ... just remembered some strange old error with McAffee antivirus and .NET, after which all the contents of the message boxes will disappear. It was, however, more than 5 years ago ...

Maybe try updating your computer? And ... wouldn't you accidentally launch McAffee? :)


Idea # 3: Send us your compiled .EXE and source files?
Idea # 4: Compile it, then break it up with Reflector and check how it was compiled. Compilers have bugs too ...
+2


source


Have you tried - to be sure - to avoid the whole string, prefix it with @ -sign?

So:


if (MessageBox.Show(@"The text in this file has changed. Do you want to save changes?",
    @"TextEditor - Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
{ //Do stuff 
} else { 
// Do stuff }

      

+2


source


Its something weird / stupid - its time to act being stupid

First question - are all your message boxes affected? If not, then in this case there is something wrong with it. If they are all affected then ... well, I don't really know what to suggest. More coffee?

The best way to do this is to keep the problem as low as possible. Create a new message box and enter only the current text (copy and paste it). Do not set any of the other parameters or take them out of the instructionsif

If that works, then the problem is with the parameters - add parameters slowly until it breaks

If not, the problem is with the text - delete the text and retype it - there might be a strange character in there - for example. has text next to MS Word ... - if that works then you're golden - otherwise remove word by word until it starts working.

I believe that you will find out that this is really stupid.

+2


source


Have you tried putting your text in a juste variable to see if it works?

string message = @"The text in this file has changed. Do you want to save changes?";
string title = "TextEditor - Confirmation";

if (MessageBox.Show,(message, title, MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) == DialogResult.Yes){ //Do stuff } else { // Do stuff }

      

+2


source


I tried it too and it seems to be ok. Perhaps check the regional / language settings on the computer you're running it on?

Is there a set size for the message boxes in the .Designer.cs form?

+1


source


Have you tried creating another solution with 1 form and the following code - btw works form me vs2008 winXP en-gb lang

using System;

using System.ComponentModel;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            if (MessageBox.Show("The text in this file has changed. Do you want to save changes?", "TextEditor - Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                MessageBox.Show("yes");
            }
            else
            {
                MessageBox.Show("no");
            }


        }
    }
}

      

+1


source


Could you try a newline \ n after "change"?

+1


source







All Articles