当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 刚学ASP.Net,学了个简单的计算器

ASP.NET
asp.net 转换人民币大小金额
编写的vs2005水晶报表程序在vs2008下正常使用的一些实现方法
asp.net下获取浏览器类型的实现代码
asp.net coolite 删除时弹出确定按钮
asp.net Forms身份验证和基于角色的权限访问
asp.net 用继承方法实现页面判断session
asp.net DataGrid 中文字符排序的实现代码
asp.net 利用IIS的404错误将文件重写成目录的简单方法
Aspx/Asp.net 防注入程序 V1.0
C# 数组查找与排序实现代码
ASP.NET通过使页面动态加载不同CSS实现多界面
LINQ学习笔记:XDocument文档与XML声明
ASP.NET教程:如何动态写入服务器端控件
XML+XSLT+CSS+JQuery+WebService组建Asp.Net网站
ASP.NET效率陷阱之:Attributes
.NET vs J2EE:面对SOA的荒谬与误解
ASP.NET学习篇(1):开篇
ASP.NET学习篇(2):安装与配置
ASP.NET学习篇(3):几个简单的ASP.ENT的例子
ASP.NET学习篇(4):服务器端的控件

ASP.NET 中的 刚学ASP.Net,学了个简单的计算器


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 50 ::
收藏到网摘: n/a

<html>
  <head>
    <title>Calculator</title>
    <script language="vb" Runat="server">
    dim c as char
    dim str as string
    dim len as integer
    dim Is2 as Boolean
    dim num1 as double
    dim num2 as double
    dim result as double
 '**************************************************
   Sub btClick(Sender as Object , E as EventArgs)
     If(Sender.Equals(btResult)) Then
        Len = LoadStr.Text.Length()
        If(Len = 0) Then  Exit Sub
        Len = LoadStr.Text.Length()
        c = Right(LoadStr.Text,1)
        str = Left(LoadStr.Text,Len-1)
        num1 = Val(str)
        num2 = Val(tbExps.Text)
        result = num2
        Select Case Asc(c)
          Case 43
            result = num1 + num2
          Case 45
            result = num1 - num2
          Case 42
            result = num1 * num2
          Case 47
            If(num2 = 0) Then
              tbExps.Text = "除数不可以为零"
              Exit Sub
            End If
            result = num1/num2
        End Select
        str = CStr(result)
        Ltrim(str)
        tbExps.Text = str 
        LoadStr.Text = "" 
     End If
'**************************************************
     If(Sender.Equals(btAdd)) Then
       LoadStr.Text = tbExps.Text + "+"
       tbExps.Text = ""
     End If 
'**************************************************
    If(Sender.Equals(btMin)) Then
      LoadStr.Text = tbExps.Text + "-"
      tbExps.Text = ""
    End If
'**************************************************
    If(Sender.Equals(btMul)) Then
      LoadStr.Text = tbExps.Text + "*"
      tbExps.Text = ""
    End If
'**************************************************
    If(Sender.Equals(btDiv)) Then
      LoadStr.Text = tbExps.Text + "/"
      tbExps.Text =""
    End If
'**************************************************
     If(Sender.Equals(btCls)) Then
       tbExps.Text = ""
     End If
 '**************************************************
     If(Sender.Equals(btBack)) Then
      If