Not Responding Error


I'm creating a clock for circuit training that will countdown from 30 to 0 then an interval countdown from 15 to 0.
I'll then repeat the process and finally a 3rd 30 sec countdown.
The next part will countdown from 60 secs to 0 and then an interval from 30 to 0.
That will complete one station and I will repeat the entire process 10 times.
The programming part is fine and I can add the "bells and whistles" later.

However I am having problems and getting a "Not Responding" error after approx 5 seconds - This dissappears when the end of the program is reached and both counters are at correct at the end, but how do I prevent the not responding.


Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Integer)

Public Sub RunCircuit() Dim CIRCUIT_TIME As Integer Dim INTERVAL_TIME As Integer Dim MyCounter As Integer CIRCUIT_TIME = 30 INTERVAL_TIME = 15 For MyCounter = 1 To 30 Me.Label1.Text = CIRCUIT_TIME Me.Label1.Refresh() Sleep(1000) CIRCUIT_TIME = CIRCUIT_TIME - 1 Next MyCounter For MyCounter = 1 To 15 If Me.Label2.Text = "10" Then Me.Label2.ForeColor = Color.Orange If Me.Label2.Text = "5" Then Me.Label2.ForeColor = Color.Red Me.Label2.Text = INTERVAL_TIME Me.Label2.Refresh() Sleep(1000) INTERVAL_TIME = INTERVAL_TIME - 1 Next MyCounter End Sub

Thank you
Posted On: Monday 24th of December 2012 01:06:31 AM Total Views:  200
View Complete with Replies

RELATED TOPICS OF Visual Basic PROGRAMMING LANGUAGE




VBA - Access 2000, not responding??

, I have been having the hardest time with displaying a progress bar in Access 2000. My "progress bar" is actually just a small form with 2 boxes (an outer box and an inner box). The inner box grows to the size of the outer box as it steps along. This is working fine... My problem is that when I try to open this progress bar form from another form, it doesn't show up. I think this is because Access is in a "not responding" state because it is doing a large amount of processing. I open the Progress bar form and initialize it before my code reaches the part where the large amount of processing begins, but it seems like the code gets ahead of itself, and starts to not respond before the Progress Bar form even has a chance to open. I don't encounter this problem if I stick MsgBoxes at the time just before or after I open the Progress bar form.... but when I take away the MsgBoxes (they only contained debug statements, so I don't want to leave them in) then the program does the whole "not responding" thing... Also, when the progress bar form *does* show up (when I have msgBoxes), I have a button on it that I would like the user to be able to press to cancel the process. When ever I try to click the button, the form goes into a "not responding" state and then the progress bar doesn't even continue to redraw its self. The code always finishes executing and returns to normal, but I would love to know how to make this form display progress and respond to a user clicking the button. I am using Me.Repaint at certain times, but that does nothing. Does anybody have any ideas or suggestions\t I would like to do something like a msgbox, where the code just waits for a couple of seconds, but I don't want to have user input.... I'm totally pulling my hair out over this! I'd appreciate ANY ideas!!!
VIEWS ON THIS POST

60

Posted on:

Friday 12th October 2012
View Replies!

click on DOM tree node & highlight corresponding html tag

,I have a webbrowser control & a treeview control...once I load a website I create a HTML DOM tree representation of the website using the code below...What I want to do now, is the following: mouse over any HTML element, which will then select the corresponding tree node on the HTML DOM Tree and the reverse, select any tree node and have the corresponding HTML element highlighted with a red border/box drawn around it Does anyone have any pointers / suggestions - I would really appreciate it... Private Sub UpdateDOM(ByVal HTMLDocument As mshtml.IHTMLDocument3) TreeView1.Nodes.Clear() TreeView1.BeginUpdate() Dim domRoot As mshtml.IHTMLElement = HTMLDocument.documentElement Dim treeRoot As New TreeNode() treeRoot.Text = "" treeRoot.Tag = domRoot TreeView1.Nodes.Add(treeRoot) CopyElementToTree(domRoot, treeRoot) TreeView1.EndUpdate() TreeView1.Expand() End Sub Private Shared Sub CopyElementToTree(ByVal element As mshtml.IHTMLElement, ByVal treeNode As TreeNode) Dim children As mshtml.IHTMLElementCollection = CType(element.children, mshtml.IHTMLElementCollection) If children.length 0 Then For Each e As mshtml.IHTMLElement In children Dim treeChild As New TreeNode() treeChild.Text = getAttrs(e) treeChild.Tag = e treeNode.Nodes.Add(treeChild) CopyElementToTree(e, treeChild) Next e Else If Not String.IsNullOrEmpty(element.innerText) Then Dim textNode As New TreeNode() textNode.Text = String.Format("""{0}""", element.innerHTML) textNode.Tag = element treeNode.Nodes.Add(textNode) End If End If End Sub Private Shared Function getAttrs(ByVal element As mshtml.IHTMLElement) As String Dim result As New StringBuilder("") Return result.ToString() End Function dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf' dp.SyntaxHighlighter.Highlight('4fd5f7f80edc4e7c858cd076ddf2b006')
VIEWS ON THIS POST

85

Posted on:

Saturday 13th October 2012
View Replies!

Detect if program is not responding!

I am hosting a little application called "cserver.exe" but sometimes it crashes for no reazon. sometimes it happens at night and it starts to be a problem. is there any way of detecting if cserver.exe stopped responding and if so, kill it and re-open it.
VIEWS ON THIS POST

131

Posted on:

Thursday 18th October 2012
View Replies!

Retrieving Corresponding Image Name from Text File, Image Doesn't Exist in Folder

If I were to retrieve an image file name, like, say, "McDonald's Big Mac", and the image for the McDonald's Big Mac file name doesn't exist in the folder. If I were to display the "nopic" image from the same folder instead of the image that doesn't exist, how would I do this
VIEWS ON THIS POST

145

Posted on:

Wednesday 24th October 2012
View Replies!

Play MP3 File in Visual Basic

hi im newer in making a program in visual basic, im making a mp3 program and i want to play it using window media player but i dont know how to do it, il make a browser to search the location path in a folder then after you find it it will display in a filelist then you can select there what file you want to play..maybe you can help me in this..
VIEWS ON THIS POST

29

Posted on:

Saturday 10th November 2012
View Replies!

Listbox and drag

I have a situation were I can pick the contents of a list box to be in an edit file. Is there a way to make alow me to drag the item from the ist box to an edit file...
VIEWS ON THIS POST

78

Posted on:

Tuesday 20th November 2012
View Replies!

Run .exe as .jpg

HELLO! I need to hide exe file in jpg. So when i open jpg , exe will activate. Is that possible THANKS.
VIEWS ON THIS POST

91

Posted on:

Wednesday 28th November 2012
View Replies!