Solved

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

Posted on 2008-06-19
3
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

624 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