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

ASP.NET
从一个舆论调查的制作谈面向对象的编程思路(二)
从一个舆论调查的制作谈面向对象的编程思路(三)
从一个舆论调查的制作谈面向对象的编程思路(四)
从一个舆论调查的制作谈面向对象的编程思路(五)
c#写的五子棋程序,供学习WinForms的鼠标事件和使用GDI+
我对.Net技术中asp.net应用的一点看法
ASP.NET连SQL7接口源代码
ASP.NET中密码保护,MD5和SHA1算法的使用
微软的远程处理框架.NET Remoting - 1
微软的远程处理框架.NET Remoting - 2
黑客写出了针对.Net平台的反编译器
在config.web中保存数据库连接串
在ASP.Net中两种利用CSS实现多界面的方法
ASP.NET中如何调用存储过程
ASP.NET中取代ASP的RS(Remote Scripting)技术的Framework
刚学ASP.Net,学了个简单的计算器
ASP.NET 链接数据库基础
一个简单的加密/解密方法
加入身份验证信息的SMTP mail发送
webconfig的设置节点说明

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 25 ::
收藏到网摘: 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