Need Help with program code freezing problems

You can talk about VB programming here

Need Help with program code freezing problems

Postby locohacker » Mon Nov 22, 2004 4:45 pm


:lol: wha up peeps, any one had any tips on how to stop a program from freezing, like this program i made

http://imfiles.com/downloadview-deta ... #dldetails

The problem I am having is that when lets say the user chooses the 10 seconds brake between each message, And when the program is in action and they decide to stop it it freezes.

lol dont know it got to do with some timer thing, like when the process start is hard to stop or some shit, dont know

so is there some thing i can put like between each message here is the code anyways for the 10 seconds message brake in a timer

Code: Select all
If Check1.Value = 1 Then
Call RoomSend(RichTextBox1.TextRTF)
DoEvents
Sleep 10000
End If
If Check2.Value = 1 Then
Call RoomSend(RichTextBox2.TextRTF)
DoEvents
Sleep 10000
End If
If Check3.Value = 1 Then
Call RoomSend(RichTextBox3.TextRTF)
DoEvents
Sleep 10000
End If
If Check4.Value = 1 Then
Call RoomSend(RichTextBox4.TextRTF)
DoEvents
Sleep 10000
End If
If Check5.Value = 1 Then
Call RoomSend(RichTextBox5.TextRTF)
DoEvents
Sleep 10000
End If


Thanks :)
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4363
Joined: Fri Dec 31, 2004 6:59 pm

Postby locohacker » Mon Nov 22, 2004 4:46 pm

Lol I think I fix went to

http://vbforums.com/showthread.php?s=&t ... eeze+timer

And found this cool code

Basically I added this code

Code: Select all
Sub Delay(ByVal nSeconds As Single)
    Dim nStart As Single
   
    nStart = Timer
   
    Do
        DoEvents
    Loop Until Timer - nStart >= nSeconds
End Sub


Then I change the timer code to this

Code: Select all
If Check1.Value = 1 Then
Call RoomSend(RichTextBox1.TextRTF)
DoEvents
Call Delay(10)
End If
If Check2.Value = 1 Then
Call RoomSend(RichTextBox2.TextRTF)
DoEvents
Call Delay(10)
End If
If Check3.Value = 1 Then
Call RoomSend(RichTextBox3.TextRTF)
DoEvents
Call Delay(10)
End If
If Check4.Value = 1 Then
Call RoomSend(RichTextBox4.TextRTF)
DoEvents
Call Delay(10)
End If
If Check5.Value = 1 Then
Call RoomSend(RichTextBox5.TextRTF)
DoEvents
Call Delay(10)
End If


Yess it doesnt freeses nomore :twisted:
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4363
Joined: Fri Dec 31, 2004 6:59 pm

Postby Kittenless » Tue Nov 23, 2004 3:17 pm

yeah it was the acutall sleep command..

the sleep command tells windows to basically ignore the application for that amount of time and give it no CPU time.

the other "Delay" allows you to skip doing stuff until the "time" is up..

basically thats what the difference between the two..

lol
Kittenless
imFiles Newbie
imFiles Newbie
 
Posts: 10
Joined: Tue Nov 23, 2004 3:07 pm

Postby locohacker » Tue Nov 23, 2004 3:33 pm

yeps with the first one, it always freeze, so it was a life saver :)
User avatar
locohacker
Site Admin
Site Admin
 
Posts: 4363
Joined: Fri Dec 31, 2004 6:59 pm

Postby Johnny5 » Sat Apr 02, 2005 7:43 pm

Try to Debug point cursor on loop then debug it
Johnny5
imFiles Junior
imFiles Junior
 
Posts: 72
Joined: Wed Dec 29, 2004 7:16 pm


Return to Visual Basic Programming

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests