Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cant 'Sleep' using this facility in VB.net 2005 brings errors

Posted on 2008-06-19
3
Medium Priority
?
256 Views
Last Modified: 2010-04-21
Hi I have this simple code

 Private Sub Button44_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button44.Click

        Sleep(5000)

        MsgBox("Hi")

    End Sub

the program waits and then at the end of the time throws up and error

A call to PInvoke function 'Form Elements BetAuto!Form_Elements_BetAuto.Module1::Sleep' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

what am I doing wrong here ?

Michal
0
Comment
Question by:MichMat
  • 2
3 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 21827763
I would do as

System.Threading.Thead.Sleep(5000)
System.Windows.Forms.MessageBox.Show("Hi")
0
 

Author Comment

by:MichMat
ID: 21827894
Finaly I can get to sleep :)
0
 

Author Closing Comment

by:MichMat
ID: 31469029
spot on answer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question