谁帮我翻译一下这段VB程序啊 我要全部翻译出来 哪位好心的帮帮忙 谢谢啦
Private StoredValue As Double
Private Const opNone = 0
Private Const opAdd = 1
Private Const opSubtract = 2
Private Const opMultiply = 3
Private Const opDivide = 4
Private Operator As Integer
Private NewEntry As Boolean
' Remove the last character.
Private Sub DeleteCharacter()
Dim txt As String
Dim min_len As Integer
txt = txtDisplay.Text
If Left$(txt, 1) = "-" Then
min_len = 2
Else
min_len = 1
End If
If Len(txt) > min_len Then
txtDisplay.Text = Left$(txt, Len(txt) - 1)
Else
txtDisplay.Text = "0"
End If
End Sub
' Clear the current entry, saved value, and operator.
Private Sub cmdClear_Click()
cmdClearEntry_Click
StoredValue = 0
Operator = opNone
End Sub
' Clear the current entry.
Private Sub cmdClearEntry_Click()
txtDisplay.Text = ""
End Sub
' Add a decimal point to the display.
Private Sub cmdDecimal_Click()
If InStr(txtDisplay.Text, ".") Then
Beep
Else
If NewEntry Then
txtDisplay.Text = "."
NewEntry = False
Else
txtDisplay.Text = txtDisplay.Text & "."
End If
End If
End Sub
' Calculate the result of the previous operation.
Private Sub cmdEquals_Click()
Dim new_value As Double
If txtDisplay.Text = "" Then
new_value = 0
Else
new_value = CDbl(txtDisplay.Text)
End If
Select Case Operator
Case opNone
StoredValue = new_value
Case opAdd
StoredValue = StoredValue + new_value
Case opSubtract
StoredValue = StoredValue - new_value
Case opMultiply
StoredValue = StoredValue * new_value
Case opDivide
StoredValue = StoredValue / new_value
End Select
Operator = opNone
NewEntry = True
txtDisplay.Text = Format$(StoredValue)
End Sub
' Add a number to the display.
Private Sub cmdNumber_Click(Index As Integer)
If NewEntry Then
txtDisplay.Text = Format$(Index)
NewEntry = False
Else
txtDisplay.Text = _
txtDisplay.Text & Format$(Index)
End If
End Sub
' Prepare to perform an operation.
Private Sub cmdOperator_Click(Index As Integer)
' Perform the previous operation.
cmdEquals_Click
' Remember this operation.
Operator = Index
' Start a new value.
NewEntry = True
End Sub
' Change the value's sign.
Private Sub cmdPlusMinus_Click()
If NewEntry Then
txtDisplay.Text = "-"
ElseIf Left$(txtDisplay.Text, 1) = "-" Then
txtDisplay.Text = Right$(txtDisplay.Text, 2)
Else
txtDisplay.Text = "-" & txtDisplay.Text
End If
End Sub
Private Sub Command1_Click()
End Sub
太大了啊 不能一次性发啊 没办法啊 谁来帮帮忙翻译一下啊
谁能帮我翻译下这段VB程序代码,就是讲下这段语句怎么编写的每句都什么...
你这个是用if语句不断嵌套,可读性不高。建议是用select case ind 应该是判断加减乘除的。这段程序通过判断ind值,来判断究竟采取哪种运算。Private Sub Command2_Click(indexAs Integer)If opnre = 0 Or index = 4 Then 如果opnre=0或index=4,那么 If ind = 0 Then 判断ind,如果ind=...
麻烦翻译下这段VB的编码。必须通俗,专业用语看不懂的。。求计算机大爷回...
Dim a As Integer a=2 【给变量a赋值2。这里由程序给变量a赋了值,因此点击按钮后,就不用你人工输入了。】For i = 1 To 2 【i是循环变量。VB中的变量允许不事先说明。】Print Fun(a) 【输出函数Fun(a)的值,i的值为1时输出1遍函数运算的值,i增长到2时再输出1遍,然后结束...
翻译一小段VBA程序代码(估计和VB差不多吧)
Private Sub Command43_Click()On Error GoTo Err_Command43_Click '如果出错,就跳到标签名为“Err_Command43_Click”的一行。Dim stDocName As String '定义一个字符串型变量 stDocName = ChrW(22995) & ChrW(21517) '把这个变量赋值为“姓名”DoCmd.OpenReport stDocName, acPreview '打开“...
谁帮我翻译一下下面这个vb程序每一部的意思?
Select 这是个告诉VB在录音套里显示出来的最基本的指令。Delete 简单,但是个非常强大的管道在同一个时间里来删除很多个录音。From 从摘录出来的方面去定义一个表格。Where 通过优先条件,录音从资料库里被选择。Order By Sorts the records by any combination of fields you chose.This should get you...
翻译vb一段代码?
这段程序的功能是把360程序设置为开机自动运行。详解如下:=== Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegSetValueEx Lib "advapi32.dll" ...
帮忙翻译一下VB代码(加点注释)
Private Sub Winsockserver_Close() \/\/服务器结束,关闭程序 Winsockserver.Close End End Sub Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long) \/\/此处用于,服务器端接收客户端请求 textsend.Visible = True textget.Visible = True Command2.Visible = True If Winsockserver....
谁给翻译下这段vb代码 这是个自动更换桌面系统
这段代码不太完整,i的值没有变化。前面那一堆Private Declare Function不说了,都是api声明,关于各个api作用你可以查api手册。 Form_Load中将定时器时间设定为三秒,并启用定时器。Static i As Integer i = i Mod 5 + 1 i求余数并加1,也就是说i的范围在1至5之间 Dim Path As String, ...
请教一段VB程序代码翻译
这就是一段条码扫描程序 分别扫入a和s条码,判断条码长度和条码头,如果有错误,则报警,并提示再次输入,否则就把条码写入excel表,并提示输入下一个条码。MMWarn.FileName = App.Path & "\\HOOK1.WAV"'设置MMC播放器要播放的音频文件,这里设置为"hook.wav"End Sub Private Sub txtBodyNo_Key...
翻译一小段VBA程序代码(估计和VB差不多吧)
简单注释了一下,希望能帮到你 Option Compare Database '设置缺省的字符串比较方法。只能在模块级使用 Private Sub Cmdclose_Click() '响应事件 On Error GoTo Err_Command30_Click '如错误跳转至错误处理(标签)DoCmd.Close '关闭窗口 Exit_Cmdclose_Click: '调用Exit_Cmdclose_Click Exit Sub...
vb 一段代码的翻译,我有些看不懂
For x = 0 To Lst1.ListCount - 1 '赋值x=0 到 Lst1的项目总数 If Lst1.Selected(x) = True Then '如果Lst1选中的第x项可用,则 Lst2.AddItem Lst1.List(x) 'Lst2添加Lst1的选中项目 Lst1.RemoveItem x 'Lst1清除选中项目 Exit For '退出赋值 End If '关闭判断 Next x '退出...