Search code examples
stringspecial-characterspunctuation

C# Keeping end-of-string punctuation in a string


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.


Solution

  • 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!