今天在百度贴吧上看到有意思的题:
用户在输入数字的时候,系统自动会将此数字转换成人民币显示,比如用户输入2300,系统就会显示两千三百元 |
我比较懒,一般会先百度一下什么的,有倒是有不过不太好(个人观点)
http://www.cnblogs.com/dxiao/articles/1216262.html
哈哈我一般对有意思的事情都比较感兴趣……嘻嘻嘻 于是我从2个小时前开始写,终于较未完美的完成了
拉了一个button两个textbox 废话就不多加了 注释的还行o(∩_∩)o...哈哈 这个东西有点意思
#region 转化部分
#region 输入框事件 限制为只能输入数字
private void tbNumber_TextChanged(object sender, EventArgs e)
{
string temp = tbNumber.Text.Trim();
if (temp != "")
{
if (!IsNumber(temp) || temp.Length > 32 || (temp.Length == 1 && temp == "0"))
tbNumber.Text = temp.Substring(0, temp.Length - 1);
}
if (temp.StartsWith("0"))
tbNumber.Text = temp.Substring(1, temp.Length - 1);
if (tbNumber.Text != "")
{
btnSayRMB.Enabled = true; btnRead.Enabled = true;
}
else
{
btnSayRMB.Enabled = false; btnRead.Enabled = false;
}
}
#endregion
#region 判断是否是数字
/// <summary>
/// 判断是否是数字
/// </summary>
/// <param name="strNumber"></param>
/// <returns></returns>
public bool IsNumber(String strNumber)