更新时间:2023-09-13 14:53:22
希望txtquantity,price,totalPrice是多变的
hope txtquantity,price,totalPrice are variabeles
int quantity = int.Parse(txtquantity);
float price =float.Parse(price);
float totalprice = float.Parse(totalPrice);
您可能意味着以下内容(其中价格
,totalprice
和txtquantity
是对象):
You probably mean the following (whereprice
,totalprice
andtxtquantity
are objects):
protected void totalprice()
{
int quantity = int.Parse(txtquantity.Text);
float price =float.Parse(price);
float totalprice = float.Parse(totalPrice);
totalprice=quantity * price;
}
您需要在C#中学习类型转换。看看这些:
http: //msdn.microsoft.com/en-us/library/ms173105.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/ms173105%28v=vs.80%29.aspx [ ^ ]
希望它有所帮助:)
You need to learn the Type casting in C#. Have a look at these:
http://msdn.microsoft.com/en-us/library/ms173105.aspx[^]
http://msdn.microsoft.com/en-us/library/ms173105%28v=vs.80%29.aspx[^]
hope it helps :)