Re: Timer
- From: "Moty Michaely" <moty@xxxxxxxxxxxxxx>
- Date: Sun, 26 Jun 2005 10:55:02 +0200
Do you need the form to be shown for each tick???
If no, try this code in your Main method.
static void Main()
{
Form1 f = new Form1();
f.Show();
Application.DoEvents(); // Refresh the form to be displayed.
System.Threading.Thread.Sleep(300); // Block the main thread for 300
ms.
f.Close();
f.Dispose(true);
// If you want, run another form with a message loop.
Application.Run(new Form2);
}
Hope this helps.
- Moty -
"Alvo von Cossel I" <AlvovonCosselI@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:C43B26B9-DA0D-468F-A5DC-6BFEF49326A0@xxxxxxxxxxxxxxxx
> yeah, sorry about that. i must have been in a hurry. i am using a timer
> but
> my code closes both forms and i only want it to close the first one. here
> is
> my code:
>
> private void timer1_Tick(object sender, System.EventArgs e)
> {
> Form1 f = new Form1();
> f.ShowDialog();
> f.Dispose();
> Close();
> }
>
> --
> Alvo von Cossel I of Germany
>
>
> "Moty Michaely" wrote:
>
>> What way are you using to do that?
>> Can you be more specific?
>>
>> - Moty-
>>
>> "Alvo von Cossel I" <AlvovonCosselI@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
>> message news:4B00BEF2-FC42-4A1B-BD78-4E20031FCEA2@xxxxxxxxxxxxxxxx
>> > hi,
>> >
>> > i have a form that stays on the screen for 300 milliseconds and then
>> > closes.
>> > straight after this, another form opens. that works but after that, the
>> > second one closes. someone suggested that i should change the static
>> > void
>> > main code which i have done and it still doesnt work. can anyone help
>> > me?
>> > if
>> > you could, id be truly grateful!
>> >
>> > cheers
>> >
>> > --
>> > Alvo von Cossel I of Germany
>>
>>
>>
.
- References:
- Prev by Date: Ritch Text - text selection background color
- Next by Date: Re: Equivelant With - End with
- Previous by thread: Re: Timer
- Next by thread: How to use createDocumentFromUrl()?
- Index(es):
Relevant Pages
|