Question

I have been searching for hours and cannot for the life of me figure out how to keep "Some question?" from turning into "?Some question"... in a messagebox, in a textbox, in a string[]. I've tried using \? I've tried appending the text +"?" and + "/?" and nothing's working! Please Help!

EDIT:

This is in C#. I have written plenty of code but the problem is very simple:

string questiontoask = "Some Question?";
MessageBox.Show(questiontoask); // this is just an example, I realize there are no buttons.

Output: ?Some Question

Or:

textBox1.Lines = somestrarray;

Output: Every line with any kind of punctuation " . , ) ( > < [ ] { } ..." converts automatically to a punctuation before string format...

This is extremely frustrating.

EDIT2:

After reading some answers and doing sometesting I discovered that my textboxes are getting automatically set to RightToLeft = yes. In the properties window it says "no" and in the .Designer.cs there is nothing set. but this still doesn't explain how it's happening in a message box. This has happened in two separate solutions, but when I make a new one there is NO ERROR!!!!!! wtf.

Was it helpful?

Solution 3

Eurika!! After trying the suggestions, and doing further debugging, I have found the solution! Or rather the problem... Somewhere along the lines I had set the Main form's RightToLeft property to YES... and since my application is Mdi-based, all of my mdichilren, and all of their components' RightToLeft property was automatically acting as YES until I changed each manually. Solution: Set MainForm.RightToLeft to NO. Now on further note, I do want some controls to be right to left, but I want to put the punctuation on the right... @"verbatim?" solved this for me. Thanks everyone!

OTHER TIPS

I made a very simple form containing nothing but a button triggering your example:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        String questiontoask = "Some Question?";
        MessageBox.Show(questiontoask);
    }
}

This does give the expected result, namely Some Question? - this problem seems to lie within your project, not C#/.NET. (Tried with 4.0 & 4.5)

This leaves you with two options: Also create a sample project and see if you can reproduce the issue, then track down the difference if you can't. Or provide us with more relevant information / a demo which actually reproduces the problem.

Check your Thread.CurrentUICulture property. If it's not en-GB or en-US, that could be the culprit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top