CSDN的搜索功能啊!寻求计数器算法
比如:(1+2)*4
比如:(1+2)*4
解决方案 »
- VB调用WCF出错如何解决。
- Object reference not set to an instance of an object. 网站运行几个月后出现的问题
- 再问一遍!!!!
- 高手们 vb.net 中怎么转义字符象 ( ) @ " 怎么写在字符串中 没分了
- 求助!水晶报表问题?
- 使用HTTP上传文件时,附件的文件名长度是否有限制?好像我目前就是这个原因。
- 怎样用进程监控WinForm程序
- 开发环境错误,请帮忙
- 关于datatable新增column的问题
- MVC路由的一个问题。根目录下“Admin”控制器和 Areas的名也是“admin”该如何访问根目录下的admin控制器
- (fzymr) 还是关于xml的问题,怎么做?
- ***模板问题,高手和版主门请进!!!发言的都给分!!!
<%@ Import NameSpace="System.Math" %>
<% @ Debug="True" %>
<script language="vb" runat="server">
'it will add 1 value at the end of the string
Private sub ins_1(S as Object, E as EventArgs)
Call dsp_txtValue("1")
End Sub
'it will add 2 value at the end of the string
Private sub ins_2(S as Object, E as EventArgs)
Call dsp_txtValue("2")
End Sub'it will add 3 value at the end of the string
Private sub ins_3(S as Object, E as EventArgs)
Call dsp_txtValue("3")
End Sub'it will add 4 value at the end of the string
Private sub ins_4(S as Object, E as EventArgs)
Call dsp_txtValue("4")
End Sub'it will add 5 value at the end of the string
Private sub ins_5(S as Object, E as EventArgs)
Call dsp_txtValue("5")
End Sub'it will add 6 value at the end of the string
Private sub ins_6(S as Object, E as EventArgs)
Call dsp_txtValue("6")
End Sub'it will add 7 value at the end of the string
Private sub ins_7(S as Object, E as EventArgs)
Call dsp_txtValue("7")
End Sub'it will add 8 value at the end of the string
Private sub ins_8(S as Object, E as EventArgs)
Call dsp_txtValue("8")
End Sub'it will add 9 value at the end of the string
Private sub ins_9(S as Object, E as EventArgs)
Call dsp_txtValue("9")
End Sub'it will add 0 value at the end of the string
Private sub ins_0(S as Object, E as EventArgs)
Call dsp_txtValue("0")
End Sub'it will add . value at the end of the string
Private sub ins_Dot(S as Object, E as EventArgs)
if Instr(txtValue.text,".", CompareMethod.Text) = 0 then
Call dsp_txtValue(".")
End If
End Sub'it will Remove the last character in the value.
Private Sub Rm_BackSpace(S as Object,E as EventArgs)
dim TempStr as String
TempStr=txtValue.Text
If TempStr.Length > 0 Then
txtValue.Text=Mid(TempStr,1,(TempStr.Length -1))
End If
End Sub'Displaying the Value in text box it will take 1 paramater and add
'that value at the of the string
private sub dsp_txtValue(iVal as String)
dim StrValue as string
StrValue=txtValue.Text if strValue.Length < 10 then
txtValue.Text = txtValue.Text & iVal
End if
End sub'It will remove entire values in the
Private sub Clear_TxtValue(S as Object, E as EventArgs)
txtValue.Text=""
Session("iProcess")=0
Session("StrPrVal")=""
End SubPublic sub Process_Add(S as Object, E as EventArgs)
call Stor_Iprocess(1)
End Sub
Public sub Process_Sub(S as Object, E as EventArgs)
call Stor_Iprocess(2)
End Sub
Public sub Process_Mul(S as Object, E as EventArgs)
call Stor_Iprocess(3)
End Sub
Public sub Process_Div(S as Object, E as EventArgs)
call Stor_Iprocess(4)
End SubPublic sub Process_Sqrt(S as Object, E as EventArgs)
Session("iProcess")=5
Process_Result(S, E)
End SubPublic sub Process_Per(S as Object, E as EventArgs)
txtValue.text=Get_Result()
Session("iProcess")=6
Process_Result(S, E)
End SubPublic sub Process_Mul1(S as Object, E as EventArgs)
Session("iProcess")=7
Session("strPrVal")=txtValue.text
Process_Result(S, E)
End SubPrivate sub Stor_Iprocess(iProcess as integer)
Dim TempStr as string
TempStr=txtValue.Text
txtValue.Text=""
Session("iProcess")=iProcess
Session("StrPrVal")=""
Session("StrPrVal")=TempStr
End SubPrivate Sub Plus_Minus(S as object,E as EventArgs)
If instr(txtValue.text,"-",CompareMethod.Text) = 0 then
txtValue.text= "-" & txtValue.text
Else
dim tempStr as String
tempStr =txtValue.text
txtValue.text= Mid(tempStr,2,tempStr.Length())
End If
End Sub
'Memory Procedures
Public Sub Mem_Mplus(S as object,E as EventArgs)
if Strcomp(trim(txtvalue.text),"",VbTextCompare) <> 0 then
Lbl.text="M"
Session("Mem")=Cdbl(Session("Mem")) + Cdbl(txtvalue.text)
End IF
End SubPublic Sub Mem_MCancel(S as object,E as EventArgs)
Session("Mem")=""
lbl.text=""
End SubPublic Sub Mem_MReCall(S as object,E as EventArgs)
txtValue.text=Session("Mem")
End SubPublic Sub Mem_MSave(S as object,E as EventArgs)
if Strcomp(trim(txtvalue.text),"",VbTextCompare) <> 0 then
Lbl.text="M"
Session("Mem")= Cdbl(txtvalue.text)
End IF
End Sub
Public sub Process_Result(S as Object, E as EventArgs)
Try
Select Case Session("iProcess")
Case 1
txtValue.Text=CDbl(Session("strPrVal")) + CDbl(txtvalue.text)
Case 2
txtValue.Text=CDbl(Session("strPrVal")) - CDbl(txtvalue.text)
Case 3
txtValue.Text=CDbl(Session("strPrVal")) * CDbl(txtvalue.text)
Case 4
txtValue.Text=CDbl(Session("strPrVal")) / CDbl(txtvalue.text)
Case 5
txtValue.Text=Sqrt(CDbl(txtvalue.text))
Case 6
txtValue.Text=(CDbl(txtvalue.text) )/100
Case 7
If StrComp(Session("strPrVal"),"0",VbTextCompare) <> 0 And StrComp(trim(Session("strPrVal")),"",VbTextCompare) <> 0 then
txtValue.Text= 1 / CDbl(Session("strPrVal"))
Else
txtValue.Text= "Can Not Be Devided by 0 or Null"
End If
Case Else
End Select
Catch Err as Exception
Response.Write(Err.ToString())
End Try Session("iProcess")=0
End Sub
Public Function Get_Result() as String
Select Case Session("iProcess")
Case 1
Get_Result=CDbl(Session("strPrVal")) + CDbl(txtvalue.text)
Case 2
Get_Result=CDbl(Session("strPrVal")) - CDbl(txtvalue.text)
Case 3
Get_Result=CDbl(Session("strPrVal")) * CDbl(txtvalue.text)
Case 4
Get_Result=CDbl(Session("strPrVal")) / CDbl(txtvalue.text)
Case 5
Get_Result=Sqrt(CDbl(txtvalue.text))
Case Else
End Select
End Function
</script>
<table height="86" border="1">
<tr>
<td colspan="6" align="center">
ASP.Net Calculator
</td>
</tr>
<tr>
<td colspan="6">
<asp:TextBox id="txtValue" name="txtValue" runat="server" Width="283px" size="42" align="right" ReadOnly="true" />
</td>
</tr>
<tr>
<td colspan="1">
<asp:Label id="Lbl" runat="Server" text="" />
</td>
<td colspan="3">
<asp:Button id="cmdBS" runat="Server" text="Back Space" onClick="Rm_BackSpace" BackColor="#400040" ForeColor="GreenYellow" Font-Bold="True" />
</td>
<td colspan="1" style="WIDTH: 45px">
<asp:Button id="cmdCE" runat="Server" text="CE" Font-Bold="True" ForeColor="GreenYellow" BackColor="#400040" />
</td>
<td colspan="1">
<asp:Button id="cmdC" runat="Server" text="C" OnClick="Clear_TxtValue" Height="24px" Width="29px" Font-Bold="True" ForeColor="GreenYellow" BackColor="#400040" />
</td>
</tr>
<tr>
<td>
<asp:Button id="cmdMc" runat="Server" text="MC" OnClick="Mem_MCancel" Font-Bold="True" ForeColor="GreenYellow" BackColor="#400040" />
</td>
<td>
<asp:Button id="cmd7" runat="Server" OnClick="ins_7" text="7" Height="24px" Width="25px" />
</td>
<td>
<asp:Button id="cmd8" runat="Server" OnClick="ins_8" text="8" Height="24px" Width="31px" />
</td>
<td>
<asp:Button id="cmd9" runat="Server" OnClick="ins_9" text="9" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmdSlash" runat="Server" OnClick="Process_Div" text="/" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmdSqr" runat="Server" text="sqrt" OnClick="Process_Sqrt" />
</td>
</tr>
<tr>
<td>
<asp:Button id="cmdMr" runat="Server" text="MR" onClick="Mem_MReCall" Font-Bold="True" ForeColor="GreenYellow" BackColor="#400040" />
</td>
<td>
<asp:Button id="cmd4" runat="Server" text="4" OnClick="ins_4" Height="24px" Width="25px" />
</td>
<td>
<asp:Button id="cmd5" runat="Server" text="5" OnClick="ins_5" Height="24px" Width="31px" />
</td>
<td>
<asp:Button id="cmd6" runat="Server" text="6" OnClick="ins_6" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmdMul" runat="Server" text="*" OnClick="Process_Mul" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmdPer" runat="Server" text="%" OnClick="Process_Per" Height="24px" Width="32px" />
</td>
</tr>
<tr>
<td>
<asp:Button id="cmdMS" runat="Server" text="MS" onClick="Mem_MSave" Font-Bold="True" ForeColor="GreenYellow" BackColor="#400040" />
</td>
<td>
<asp:Button id="cmd1" runat="Server" text="1" OnClick="ins_1" Height="24px" Width="25px" />
</td>
<td>
<asp:Button id="cmd2" runat="Server" text="2" OnClick="ins_2" Height="24px" Width="31px" />
</td>
<td>
<asp:Button id="cmd3" runat="Server" text="3" OnClick="ins_3" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmdSub" runat="Server" text="-" OnClick="Process_Sub" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmd1byX" runat="Server" text="1/x" OnClick="Process_Mul1" Height="24px" Width="32px" />
</td>
</tr>
<tr>
<td>
<asp:Button id="cmdMPlus" runat="Server" text="M+" OnClick="Mem_Mplus" Font-Bold="True" ForeColor="GreenYellow" BackColor="#400040" />
</td>
<td>
<asp:Button id="cmd0" runat="Server" text="0" OnClick="ins_0" Height="24px" Width="25px" />
</td>
<td>
<asp:Button id="cmdPbyM" runat="Server" text="+/-" onClick="Plus_Minus" Height="24px" Width="31px" />
</td>
<td>
<asp:Button id="cmdDot" runat="Server" text="." OnClick="ins_Dot" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmdAdd" runat="Server" text="+" OnClick="Process_Add" Height="24px" Width="28px" />
</td>
<td>
<asp:Button id="cmdEql" runat="Server" text="=" OnClick="Process_Result" Height="24px" Width="32px" />
</td>
</tr>
</table>
</Form>