|
|
|
การใช้คำสั่ง หรือรูปแบบคำสั่ง Convert.ToInt32 ทำไมถึง error |
|
|
|
|
|
|
|
เอา Code กับรูปมาดูหน่อยครับ
|
|
|
|
|
Date :
2012-05-24 17:00:12 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2012-05-24 17:05:01 |
By :
Nan Tuesday |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
private void buttonCalculate_Click(object sender, EventArgs e)
{
double price = Convert.ToDouble(textPrice.Text);
int quantity = Convert.ToInt32(textQuantity.Text);
double total = price * quantity;
textTotal.Text = Convert.ToString(total);
}
|
|
|
|
|
Date :
2012-05-24 17:05:45 |
By :
Nan Tuesday |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
textTotal.Text = (string)total;
or
Code (C#)
textTotal.Text = total.ToString();
ลองแบบนี้ดูครับ
|
|
|
|
|
Date :
2012-05-24 17:20:00 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้ว .ToDouble , .ToInt32 ล่ะคะ
|
|
|
|
|
Date :
2012-05-24 17:32:24 |
By :
Nan Tuesday |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วค่ะ ขอบคุณ คุณ mr.win มากค่ะ
|
|
|
|
|
Date :
2012-05-24 17:40:36 |
By :
Nan Tuesday |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตกลงใช้แบบไหนครับ
|
|
|
|
|
Date :
2012-05-24 17:45:03 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใช้แบบที่สองค่ะ
|
|
|
|
|
Date :
2012-05-24 18:04:51 |
By :
Nan Tuesday |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|