Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can I to do something in same method after use timeSetEvent .

What I have tried:

timerCB = new TimerCallback(CBn);

private void SendMidi()
{
    midiOutShortMsg(hmidi, msg);

    timerID = timeSetEvent(1000, 0, timerCB, UIntPtr.Zero, 0);

    *** How can I Write the code here to do something after the delay time ****
}


public async void CBn(uint uTimerID, uint uMsg, UIntPtr dwUser, UIntPtr dw1, UIntPtr dw2)
{
    timeKillEvent(timerID);
    timerID = 0;
    textBox.Text = beat.ToString();
}
Posted
Updated 18-Oct-22 14:52pm
Comments
Richard Deeming 19-Oct-22 8:05am    
Avoid async void methods[^] - there is almost always a better way.

1 solution

Google is great for finding common tasks like using timers: c# timer example[^]

Here is a result from the above search: Timer in C# | Top 3 Examples to Implement of Timer in C#[^]

There are others if you're not happy with that link.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900