Click here to Skip to main content
15,887,333 members
Home / Discussions / C#
   

C#

 
AnswerRe: Where is this c# console application running from?? Pin
Roger Wright8-Mar-12 17:30
professionalRoger Wright8-Mar-12 17:30 
AnswerRe: Where is this c# console application running from?? Pin
RobCroll9-Mar-12 3:19
RobCroll9-Mar-12 3:19 
GeneralRe: Where is this c# console application running from?? Pin
Roger Wright9-Mar-12 5:02
professionalRoger Wright9-Mar-12 5:02 
AnswerRe: Where is this c# console application running from?? Pin
jschell9-Mar-12 5:23
jschell9-Mar-12 5:23 
GeneralRe: Where is this c# console application running from?? Pin
Vasudevan Deepak Kumar9-Mar-12 9:54
Vasudevan Deepak Kumar9-Mar-12 9:54 
QuestionDecimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
nhanlaptrinh8-Mar-12 16:03
nhanlaptrinh8-Mar-12 16:03 
AnswerRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
OriginalGriff8-Mar-12 20:37
mveOriginalGriff8-Mar-12 20:37 
GeneralRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
nhanlaptrinh9-Mar-12 0:56
nhanlaptrinh9-Mar-12 0:56 
We now want to enter the number into the textbox, textbox itself decimal format and displays the time on that textbox. For example, enter "123456789", the textbox will appear as 123,456,789. I have a problem when entering a string from 1 to 9 are ok, but when inserting a number in the range from 1 to 9, the textbox back to position the cursor on the first position, thanks to your help with , thank you very much.

Code I wrote
C#
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text != "")
                {
                    int iIndex = textBox1.Text.IndexOf('.');
                    if (iIndex != -1)
                    {
                        string strT = textBox1.Text.Substring(iIndex + 1, 1);
                    }
                    double a = double.Parse(textBox1.Text.Trim(','));
                    if (textBox1.SelectionStart >= textBox1.Text.Length)
                    {
                        textBox1.Text = a.ToString("#,###");
                        textBox1.SelectionStart = textBox1.Text.Length;
                    }
                    else
                    {
                        textBox1.Text = a.ToString("#,###"); 
                        //Help?
                    }
                }
            }
            catch (Exception) { MessageBox.Show("Must enter the number ."); }
        }


modified 9-Mar-12 7:18am.

GeneralRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
Bernhard Hiller9-Mar-12 2:23
Bernhard Hiller9-Mar-12 2:23 
GeneralRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
nhanlaptrinh9-Mar-12 2:35
nhanlaptrinh9-Mar-12 2:35 
GeneralRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
nhanlaptrinh9-Mar-12 16:49
nhanlaptrinh9-Mar-12 16:49 
AnswerRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
Bernhard Hiller8-Mar-12 21:41
Bernhard Hiller8-Mar-12 21:41 
AnswerRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
PIEBALDconsult9-Mar-12 2:26
mvePIEBALDconsult9-Mar-12 2:26 
GeneralRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
nhanlaptrinh9-Mar-12 4:08
nhanlaptrinh9-Mar-12 4:08 
AnswerRe: Decimal format in the textbox Text Change C# (1000000 -> 1,000,000) Pin
nhanlaptrinh9-Mar-12 11:50
nhanlaptrinh9-Mar-12 11:50 
Questiondatagrid Pin
MemberDotNetting8-Mar-12 11:05
MemberDotNetting8-Mar-12 11:05 
AnswerRe: datagrid Pin
Dave Kreskowiak8-Mar-12 11:40
mveDave Kreskowiak8-Mar-12 11:40 
GeneralRe: datagrid Pin
Vasudevan Deepak Kumar9-Mar-12 9:56
Vasudevan Deepak Kumar9-Mar-12 9:56 
QuestionMessage Closed Pin
8-Mar-12 10:54
WebMaster8-Mar-12 10:54 
AnswerRe: Property Name Sementics - IsEmpty or Empty Pin
Ravi Bhavnani8-Mar-12 11:00
professionalRavi Bhavnani8-Mar-12 11:00 
AnswerRe: Property Name Sementics - IsEmpty or Empty Pin
PIEBALDconsult8-Mar-12 11:06
mvePIEBALDconsult8-Mar-12 11:06 
AnswerRe: Property Name Sementics - IsEmpty or Empty Pin
Dave Kreskowiak8-Mar-12 11:34
mveDave Kreskowiak8-Mar-12 11:34 
AnswerRe: Property Name Sementics - IsEmpty or Empty PinPopular
Luc Pattyn8-Mar-12 11:54
sitebuilderLuc Pattyn8-Mar-12 11:54 
GeneralRe: Property Name Sementics - IsEmpty or Empty Pin
PIEBALDconsult8-Mar-12 15:26
mvePIEBALDconsult8-Mar-12 15:26 
AnswerRe: Property Name Sementics - IsEmpty or Empty Pin
Luc Pattyn8-Mar-12 15:41
sitebuilderLuc Pattyn8-Mar-12 15:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.