Ace Master Posted February 19, 2004 Posted February 19, 2004 Hi. I have a function, which is called many times (unknown number) I want to make something during the �call� of the function. Some loading label for user to wait for data. All I want to know is when the calling is over for that particularly function the label to go invisible and when is called again to turn visibility on. I made something whit odd/even numbers, but obvious is not working because the last number in contor can't always be odd Public Sub loading() contor = contor + 1 If contor Mod 2 Then rosu.Text = "LOADING..." Else rosu.Text = "" End If End Sub Thanks Quote
Procaine Posted February 19, 2004 Posted February 19, 2004 I don't know if there's a solution to this. If the loop is called an unknown number of times, how is the function going to know when the calling has ended? Quote
Heiko Posted February 19, 2004 Posted February 19, 2004 I don't understand your problem. Why don't you set the label visible in the first line of code in the sub und set it invisible in the last ? Quote .nerd
Administrators PlausiblyDamp Posted February 19, 2004 Administrators Posted February 19, 2004 Couldn't you pass in the max value for contor as a parameter and hide the label when it's reached? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Ace Master Posted February 19, 2004 Author Posted February 19, 2004 The function is called when I receive data from the RS232. So I don�t know how much info I�ll receive to put a max value. Heiko >> you idea doesn�t seems to work. L When I press the get status from RS232 I want to have some �animation� until the receiving is over, that�s all I want. Quote
Heiko Posted February 19, 2004 Posted February 19, 2004 I see now. When *you* can't tell when the receiving is over, how can the program ? The only possibility I see is that you define a max idle time. then set up a timer that (re)starts running whenever the sub is called. In the sub set the label visible, too. Set the Timer interval to your max idletime. In the tick event handler, let the label dissapear and stop the timer. Quote .nerd
Ace Master Posted February 19, 2004 Author Posted February 19, 2004 thanks based on your ideea I put "label off" in my timer tick event . So now I have visible in my function and hide in my tick event. Is exactly want I wanted. :) .. because the timer tick is always, the label will be off when the receiving is over. thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.