VB.Net Display MsgBox but continue application

Discussion in 'Visual Basic .Net' started by DN Admin, Apr 12, 2012.

  1. DN Admin

    Staff Member

    Joined:
    Aug 7, 2010
    Location:
    Joliet, IL U.S.A.
    I have this For Next Loop with a Delay that runs but it stops running till I hit OK on the MsgBox. what is the best way to do a task x times with x delay but not wait for MsgBox.

    <pre class="prettyprint lang-vb <span class="kwd Private</span><span class="pln </span><span class="kwd Sub</span><span class="pln Button2_Click</span><span class="pun (</span><span class="kwd ByVal</span><span class="pln sender </span><span class="kwd As</span><span class="pln System</span><span class="pun .</span><span class="kwd Object</span><span class="pun ,</span><span class="pln </span><span class="kwd ByVal</span><span class="pln e </span><span class="kwd As</span><span class="pln System</span><span class="pun .</span><span class="pln EventArgs</span><span class="pun )</span><span class="pln </span><span class="kwd Handles</span><span class="pln Button2</span><span class="pun .</span><span class="pln Click
    </span><span class="kwd Dim</span><span class="pln var </span><span class="kwd As</span><span class="pln </span><span class="kwd Integer</span><span class="pln
    </span><span class="kwd Dim</span><span class="pln startVal </span><span class="kwd As</span><span class="pln </span><span class="kwd Integer</span><span class="pln
    </span><span class="kwd Dim</span><span class="pln endVal </span><span class="kwd As</span><span class="pln </span><span class="kwd Integer</span><span class="pln
    startVal </span><span class="pun =</span><span class="pln </span><span class="lit 1</span><span class="pln
    endVal </span><span class="pun =</span><span class="pln </span><span class="lit 5</span><span class="pln
    </span><span class="kwd For</span><span class="pln var </span><span class="pun =</span><span class="pln startVal </span><span class="kwd To</span><span class="pln endVal
    System</span><span class="pun .</span><span class="pln Threading</span><span class="pun .</span><span class="pln Thread</span><span class="pun .</span><span class="pln Sleep</span><span class="pun (</span><span class="lit 2000</span><span class="pun )</span><span class="pln
    MsgBox</span><span class="pun (</span><span class="str "Message Box Shows "</span><span class="pln </span><span class="pun &</span><span class="pln var </span><span class="pun &</span><span class="pln </span><span class="str " Times "</span><span class="pun )</span><span class="pln
    </span><span class="kwd Next</span><span class="pln var
    </span><span class="kwd End</span><span class="pln </span><span class="kwd Sub</span></pre>

    View the full article
     
    #1

Share This Page