Dear Friends,
I want to compare two values of textboxs please, check my code

Int32 val11 = Convert.ToInt32(textBox4.Text);
                Int32 val22 = Convert.ToInt32(textBox10.Text);
                if(val11 >> val22)
                {                    
                        MessageBox.Show("Please, check Maximum Limit of Quantity.Quantity should be less tha fix Limit", "Limit", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
                        textBox15.Focus();
                        textBox4.ForeColor = Color.Red;
                    }
                    else
                    {
                        textBox4.ForeColor = Color.Green;
                    }

I got error.

Error CS0029 Cannot implicitly convert type 'int' to 'bool'

What is that '>>' doing ther on line 3? Should be '>' I guess.
As an advise on the side, don't name your textboxes textbox15 whatever number. Give them meaningful names. Please do.

Why not just compare the string values?

commented: Sounds equivalent to the intent. +12

Dear rproffitt,
Please, check line no.3

Dear Reverend Jim!
Please, Suggest me ....

What if a user typed 'abc' instead of '123' in your textbox?
INT32.Convert would fail and you could embed it in a try-catch block and annoy your user with other messagboxes.
Another option is to use the method INT32.TryParse but with the same problems.
Best is to not allow the user to type in wrong characters, see example here.
After that you could safely use the suggestion of the Reverend amen.

If TextBox4.Text == TextBox10.Text Then

Thanks friends,
I soved it.

            Int32 val11;
            Int32 val22;
            Int32.TryParse(textBox4.Text, out val11);
            Int32.TryParse(textBox10.Text, out val22);
            if (val11 < val22)
            {
                MessageBox.Show("Please, check Maximum Limit of Quantity.Quantity should be less tha fix Limit", "Limit", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
                textBox15.Focus();
                textBox15.Clear();
                textBox10.ForeColor = Color.Red;
            }
            else
            {
                textBox10.ForeColor = Color.White;
            }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.