最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp.net简单的计数器
时间:2008-02-29 编辑:简简单单 来源:一聚教程网
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!this.IsPostBack)
{
// 数字的显示和存放
this.show.Text="0";
// 存放符号,如+
this.tp.Text="";
}
}
private void yi_Click(object sender, System.EventArgs e)
{
int tmp=Convert.ToInt32(this.show.Text);
// 没有符号存在的情况下
if(this.tp.Text=="")
{
if(tmp==0)
{
this.show.Text="1";
}
else
{
this.show.Text+="1";
}
}
// 有符号存在的条件下
else
{
if(this.show.Text=="0")
{
this.show.Text="1";
}
else
{
this.show.Text+="1";
}
}
}
private void er_Click(object sender, System.EventArgs e)
{
int tmp=Convert.ToInt32(this.show.Text);
// 没有符号存在的情况下
if(this.tp.Text=="")
{
if(tmp==0)
{
this.show.Text="2";
}
else
{
this.show.Text+="2";
}
}
// 有符号存在的条件下
else
{
if(this.show.Text=="0")
{
this.show.Text="2";
}
else
{
this.show.Text+="2";
}
}
}
private void jia_Click(object sender, System.EventArgs e)
{
if(this.tp.Text=="")
{
this.first.Text=this.show.Text;
this.tp.Text="+";
this.show.Text="0";
}
else
{
this.show.Text=Convert.ToString(Convert.ToInt32(this.first.Text)+Convert.ToInt32(this.show.Text));
this.tp.Text="+";
this.first.Text=this.show.Text;
this.show.Text="0";
}
}
private void deng_Click(object sender, System.EventArgs e)
{
if(this.tp.Text=="")
{
;
}
else
{
this.show.Text=Convert.ToString(Convert.ToInt32(this.first.Text)+Convert.ToInt32(this.show.Text));
this.tp.Text="";
this.first.Text=this.show.Text;
}
}
}
}
-
上一个: .net分页代码
-
下一个: Asp.Net中的HttpHandler
相关文章
- asp.net简单性能计数器---老赵版改良 07-06
- asp.net中操作符简单介绍 02-03
- asp.net sitemap简单使用详解 02-11
- asp.net控件开发(二)-简单属性 06-03
- 一个简单的ASP.NET Forms 身份认证 01-18
- ASP.NET简单整理收藏(1) 01-12