
正文
vb.net的等待功能 vb 等待
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.NET,如何用TIMER控件计时
这种功能用不到TIMER,TIMER控件用在这种地方也不适合。(假如你所统计的时间很短,在几分中内话,可以使用,假如你统计的时间很长:几小时、几天几夜,建议改用以下方式):
在你需要开始计时的地方加入一个记录当前时间,在你想结束的地方也得到一个当前时间。然后将两个时间相减。
希望以上思路可以帮到你。
相关问答
Q1: vb.net 如何实现1ms精度的定时器功能
请参考:
Dim eTime As DateTime
Dim sTime As DateTime
sTime = DateTime.Now()
For i As Integer = 0 To 100000
Next i
eTime = DateTime.Now()
Dim Scound As Double = Math.Round(((eTime - sTime).TotalMilliseconds() / 1000), 4)
MessageBox.Show("当前循环总计用时:" + Scound.ToString() + " 秒")
也可以使用Stopwatch
Dim stopWatch As New Stopwatch()
Q2: WPF下实现Timer功能(VB.net代码)
Public WithEvents timer As DispatcherTimer = New DispatcherTimer()
其他跟vb.net窗体应用程序timer控件一样
Q3: VB.net过程的调用
Sub过程实现:
Sub FactsSub(ByVal intN As Integer, ByRef result As Long)
Dim i As Integer
Dim lngResult As Long
lngResult = 1
For i = 1 To intN
lngResult *= i
Next
result = lngResult
End Sub
Private Sub btnSub_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSub.Click
Dim i As Integer
Dim sum As Long = 0
Dim result As Long
For i = 1 To 10
FactsSub(i, result)
sum += result
Next
MsgBox("过程实现 1! + 2! + 3! + … + 10! = " sum)
End Sub
Function函数实现:
Function FactsFunction(ByVal intN As Integer) As Long
Dim i As Integer
Dim lngResult As Long
lngResult = 1
For i = 1 To intN
lngResult *= i
Next
Return lngResult
End Function
Private Sub btnFunction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFunction.Click
Dim i As Integer
Dim sum As Long = 0
For i = 1 To 10
sum += FactsFunction(i)
Next
MsgBox("函数实现 1! + 2! + 3! + … + 10! = " sum)
End Sub
Q4: 如何正确理解VB.NET延时函数
第一个for完成对delay_time参数的控制,即共循环多少次内部循环
第二个for(内部循环),完成对j从0到199的控制,共循环200次。
翻译成汇编就是:
(R0为传递参数)
DELAY:
MOV R1,#200
DJNZ R1,$
DJNZ R0,DELAY
RET
Q5: 关于VB.NET的timer控件中Enabled的用法
template class T,class GETKEY
T *Serial_Partitioned(T *pData, UINT uDataLen,UINT uRadix,
UINT uKeyIndex, GETKEY GetKeyFunc,
UINT *puBoxDataCount, T *pOutDatga,
DATA_ARRAY_TEMPT *pArray)
{
vb.net的等待功能的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb 等待、vb.net的等待功能的信息别忘了在本站进行查找喔。








