Click here to Skip to main content
15,906,173 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if (txtBalance.Text == 0)
{
txtOrderStatus.Text = "Paid";
}
else
{
txtOrderStatus.Text = "Unpaid Balance";
}
Posted
Updated 9-May-11 21:24pm
v2
Comments
Toniyo Jackson 10-May-11 3:25am    
What is the error?
Tarun.K.S 10-May-11 3:25am    
txtBalance.Text == "0"?
Pong D. Panda 10-May-11 3:26am    
well spotted!
[no name] 10-May-11 4:36am    
You are right. But that was not the question. He wants to know how we correct this code. The right answer: Read the compiler error which is here sure to come. Then, look at the code line. After that, think about how the error may relate to the code line, using the MSDN if needed. Last, replacing the (hopefully) spotted error with correct code. And, most of all, not by posting questions to such obvious things without even mentioning the error and its location.

You can use this
VB
if (Convert.toInteger16(txtBalance.Text) == 0)


or

if (txtBalance.Text == "0")
 
Share this answer
 
v2
Comments
Pong D. Panda 10-May-11 3:30am    
Second one is correct. My vote of 2 was because Convert.toInterger16 might throw an error, use int.TryParse instead.
Hi wolfsor,

You can use this one also :

if (txtBalance.Text.Equals("0"))


I hope this help,
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900