Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Delay problem

tcf4tcf4 Posts: 49Member
In my program, I've run into a huge delay problem. I'm not sure exactly why it is occurring, but it is causing a lot of other problems as a result. I've found a way get around the delay problem, DoEvents, but that is causing a lot of other problems on its own accord. When I don't use DoEvents, it seems as if the program is almost skipping over some events or not fully completing them. For instance,

[code]
ExplanationForm.Hide

WaitForm.Show

Load ChangeSettingsForm
Load ConnectionTestForm
Load TestForm

WaitForm.Hide

ConnectionTestForm.Show

Unload ExplanationForm
Unload setupform
Unload EnterDateForm

ConnectionTestForm.ConnectionTestTime.Enabled = True
[/code]

where waitform.show isn't being completed fully and it's going on to the loads. (In the loads is where I have the huge delay because I'm calling a few data acquisition control units through an interface card.) Also, some single line commands don't get completed properly because the delay will cause the program to pause tremendously while talking to the board. The problem is fixed when I add DoEvents, but then different problems occur. The delay is still there, but the program continues running and it'll make the call again to get data while it's still collecting data the first time, which crashes my program. Either way, I lose. Is there any way to figure this out, or am I just really screwed?

Comments

  • lionblionb Posts: 1,688Member ✭✭
    : In my program, I've run into a huge delay problem. I'm not sure exactly why it is occurring, but it is causing a lot of other problems as a result. I've found a way get around the delay problem, DoEvents, but that is causing a lot of other problems on its own accord. When I don't use DoEvents, it seems as if the program is almost skipping over some events or not fully completing them. For instance,
    :
    : [code]
    : ExplanationForm.Hide
    :
    : WaitForm.Show
    :
    : Load ChangeSettingsForm
    : Load ConnectionTestForm
    : Load TestForm
    :
    : WaitForm.Hide
    :
    : ConnectionTestForm.Show
    :
    : Unload ExplanationForm
    : Unload setupform
    : Unload EnterDateForm
    :
    : ConnectionTestForm.ConnectionTestTime.Enabled = True
    : [/code]
    :
    : where waitform.show isn't being completed fully and it's going on to the loads. (In the loads is where I have the huge delay because I'm calling a few data acquisition control units through an interface card.) Also, some single line commands don't get completed properly because the delay will cause the program to pause tremendously while talking to the board. The problem is fixed when I add DoEvents, but then different problems occur. The delay is still there, but the program continues running and it'll make the call again to get data while it's still collecting data the first time, which crashes my program. Either way, I lose. Is there any way to figure this out, or am I just really screwed?
    :
    Not sure what caused delay but seem to me you can use some wait API functions like WaitForMultipleObjectsEx to avoid crash. Try to search net for VB code example to use those API. I've never used them.
  • tcf4tcf4 Posts: 49Member

    : Not sure what caused delay but seem to me you can use some wait API functions like WaitForMultipleObjectsEx to avoid crash. Try to search net for VB code example to use those API. I've never used them.
    :
    So essentially an API function stops the entire program in order to finish executing a piece of code, right? Is the delay really bad? Because that's one of the problems I originally had and I don't want to delay the program just as badly in a different way. Has anyone used these functions? Do you have any advice?
  • lionblionb Posts: 1,688Member ✭✭
    :
    : : Not sure what caused delay but seem to me you can use some wait API functions like WaitForMultipleObjectsEx to avoid crash. Try to search net for VB code example to use those API. I've never used them.
    : :
    : So essentially an API function stops the entire program in order to finish executing a piece of code, right? Is the delay really bad? Because that's one of the problems I originally had and I don't want to delay the program just as badly in a different way. Has anyone used these functions? Do you have any advice?
    :
    Like I said before, I have never used that function. Take a look at link
    http://www.codeproject.com/threads/WaitFunctions.asp?df=100&forumid=23240&exp=0&select=1063495
    There is some expalnations and code example.
Sign In or Register to comment.