我有一個問題做出釐米到C#腳/英寸的轉換器,這是一個多麼GOT:釐米至英寸轉換器,兩個文本框multply值
<asp:textbox id="txtFoot" runat="server"></asp:textbox>
<asp:textbox id="txtInches" runat="server"></asp:textbox>
<asp:Button id="btnAdd" runat="server" text="Count" onclick="btnAdd_Click" />
<br />
<asp:Label ID="lblResult" runat="server"></asp:Label>is<asp:Label ID="lblFootAndInches" runat="server"></asp:Label>cm
<%--I try to get a result "10'1" is 3,939 cm"--%>
protected void btnAdd_Click(object sender, EventArgs e)
{
lblResult = (txtFoot.Text + "," + txtInches.Text) * 0,39; //I would like to get 10,1 * 0,39 = 3,939 (10 foot and 1 inch)
lblFootAndInches = txtFoot.Text + "'" + txtInches.Text + '"'; //I'm looking for a result like 10'1"
}
我在Replace上遇到錯誤,無法解析符號Replace和lblResult,無法轉換源類型爲目標類型的字符串,但thx試圖幫助 – Nicklas 2010-11-09 06:22:37
對不起,顯然,如果你看看我的代碼,你會發現我省略了一些.Text屬性,現在已經修復了 – 2010-11-09 14:11:54
很棒完美的作品!非常感謝! – Nicklas 2010-11-09 16:18:17