|
-
Jan 8th, 2007, 10:52 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Run Time
if (lblTime.Text == MyString) //format to "hh:mm tt"
{
MessageBox.Show("hoy AM");
return 0;
}
above code problem is that showing multiple messagebox, i tried already this program in VB6 message box shows only once, but in C#.net i didn't yet press the OK button but continuously appear,
i want only to appear the message box once when my time is equal the system time
tnx.
-
Jan 8th, 2007, 10:57 PM
#2
Re: Run Time
That code is only going to show one message. If you're seeing multiple messages then you must be executing that code multiple times.
-
Jan 9th, 2007, 12:34 AM
#3
Fanatic Member
Re: Run Time
I think you accedentally put the code in form Activate event handler.
-
Jan 9th, 2007, 01:30 AM
#4
Thread Starter
Hyperactive Member
Re: Run Time
nope what i mean it is executing many times, not once
did you try... i want once only
tnx for youe help
-
Jan 9th, 2007, 01:40 AM
#5
Thread Starter
Hyperactive Member
Re: Run Time
it must be in the timer event right?
because as i've said i already did this in VB6, now i'm trying to do it
in C#.Net and that is my problem...
-
Jan 9th, 2007, 01:49 AM
#6
Re: Run Time
As I said, the code you posted will only display a single message. If you are seeing multiple messages then you must be executing it multiple times. As you haven't posted any other code then we can't possibly know. If that code is in a Timer's Tick event handler then it will be executed every time the Timer Ticks, of course. If the expression in the If statement is True then the message will be displayed. If the expression is True on more than one occasion that the code is executed then more than one message will be displayed, of course. We have no idea where this code fits in with the rest of your app or what the values of lblTime.Text or MyString are, so we cannot possibly tell you exactly why you're getting more messages than you want. We don't have ESP.
-
Jan 9th, 2007, 02:16 AM
#7
Fanatic Member
Re: Run Time
The question is where you put the code and where you initialize this two object before you compare? If you initialize outside the the timer event it would be posible that you can see multiple message because this two object values still the same as the timer ticks. Try to change the value of the one object after this line ...MesageBox.Show........
-
Jan 9th, 2007, 07:08 PM
#8
Thread Starter
Hyperactive Member
Re: Run Time
already fixed this problem, just put a flag as boolean on the timer event
tnx nway...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|