VB.net中带有计时器的垃圾邮件框 [英] Spam messagebox with timer in VB.net

查看:75
本文介绍了VB.net中带有计时器的垃圾邮件框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我在下面有这段代码,当表单出现时,将处理垃圾邮件消息框.

Ok, I have this code below, when a form will appear, a message box spam will be in processed.

Private Sub form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
timer.Start()

Private Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrnote.Tick
        MsgBox("I got you!", vbCritical, "LOL")



但是,我希望仅显示10个消息框,然后将其置于顶部,并显示另一种形式.这个怎么做?



However, I want that only 10 messagebox to appear then after that it will be topped, and another form will appear. How to do this? It''s a prank software, I''m doing.

推荐答案

使用静态变量:
Use static variable:
Private Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrnote.Tick
Static iCount as Integer
    if iCount <10 then MsgBox("I got you!", vbCritical, "LOL")
    iCount = iCOunt +1


或全局变量:


or global variable:

Dim iCount As Integer = 0
Private Sub timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrnote.Tick
    if iCount >10 then MsgBox("I got you!", vbCritical, "LOL")
    iCOunt = iCount+1


[添加到您从losmac获得的上一个答案]

首先,您在这里不需要静态或全局变量,可以将计数变量设为表单派生类中的成员字段.

并在第11次调用中,停止计时器,并显示您的新表单(所有这些操作都可以在计时器滴答处理程序中完成).
[Adding to the previous answer you got from losmac]

First of all you don''t need a static or global variable here, you can make your count variable a member field in the form derived class.

And on the 11th call, stop the timer, and show your new form (all this can be done in the timer tick handler).


这篇关于VB.net中带有计时器的垃圾邮件框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆