| 网站首页 | VB.Net实例分析 | .Net技术文摘 | 下载中心 | VB.Net书籍笔记 | .Net源码 | VBS脚本与组件调用 | Windows2008技术文摘 | 给我们留言 | 
最新公告:

  没有公告

您现在的位置: 乐博网 >> VB.Net实例分析 >> 服务进程编程 >> 实例分析正文
最新推荐 更多内容
Threading-Timers的实例
Threading-Timers的实例
作者:sdk    来源:microsoft     更新时间:2008-1-9

所属分类 : Threading

Timers的实例

代码如下:

'-----------------------------------------------------------------------
'  This file is part of the Microsoft .NET Framework SDK Code Samples.
'
'  Copyright (C) Microsoft Corporation.  All rights reserved.
'
'This source code is intended only as a supplement to Microsoft
'Development Tools and/or on-line documentation.  See these other
'materials for detailed information regarding Microsoft code samples.
'
'THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'PARTICULAR PURPOSE.
'-----------------------------------------------------------------------
'  File:      TimedCallback.vb
'
'  Summary:   Demonstrates the use of the Timer class to generate a
'             periodic callback to a method.
'---------------------------------------------------------------------

Option Explicit On
Option Strict On


Imports System
Imports System.Threading


Class App
   
    Public Shared Sub Main()
        Console.WriteLine("Checking for status updates every 2 seconds.")
        Console.WriteLine("   (Hit Enter to terminate the sample)")
        Dim myTimer As New Timer(New TimerCallback(AddressOf CheckStatus), Nothing, 0, 2000)
        Console.ReadLine()
 myTimer.Dispose()
    End Sub 'Main
   
   
   
    ' The callback method's signature MUST match that of a System.Threading.TimerCallback
    ' delegate (it takes an Object parameter and returns void)
    Shared Sub CheckStatus(state As Object)
        Console.WriteLine("Checking Status.")
    End Sub 'CheckStatus ' ...
End Class 'App

  • 上一篇:

  • 下一篇:
  • 【字体: 】【打印此文】【关闭窗口
      相关文章:(只显示最新16条)
    Threading-WaitSynchronization的实例
    Threading-ReaderWriterSynchronization的实例
    Threading-Pools的实例
    Threading-MonitorSynchronization的实例
    Threading-JoinThread的实例

    | 设为首页 | 加入收藏 | 联系站长 | | 友情链接 | 版权申明 |
    乐博网欢迎各种媒体转载我们的原创作品[转载请注明出处];我们鼓励更多VB.Net开发者一起加入研究与探讨;如发现文章访问错误、内容错误或版权疑问、内容有违相关法律(如涉及政治、色情、反动或散布虚假有害信息)等情况,请及时向我们举报,我们将及时纠正!
    联系邮箱:Shiny#vip.qq.com (#替换为@) QQ交流群: 40797788 [闽ICP备05014267号]