using System;
using System.Windows.Forms;
using System.Threading;
/*
@descrip Execute two forms with "application.run" method.
@autor José Jesús Ambriz Meza
@fecha 19/03/2010
@version 1
*/
namespace variasVentanas
{
public class ventana: Form
{
public ventana(string t)
{
this.Text= t;
}
//start method for threading
public void inicio()
{
Application.Run( this ); //start this application
}
public static void Main()
{
//new ventana object ( form object )
ventana obj1= new ventana("uno");
//new ventana object ( form object )
ventana obj2= new ventana("dos");
//new thread with obj1
Thread t1= new Thread( obj1.inicio );
//new thread with obj2
Thread t2= new Thread( obj2.inicio );
//execute Application.Run with obj1
t1.Start();
//execute Application.Run with obj2
t2.Start();
}
}
}
Compartiendo para dos mundos
Hablando de programación paralela.
Tutoriales en: https://www.youtube.com/user/jambrizgdl
Twitter: @dogoteacher
Buscar este blog
Mostrando entradas con la etiqueta system.threading. Mostrar todas las entradas
Mostrando entradas con la etiqueta system.threading. Mostrar todas las entradas
viernes, 19 de marzo de 2010
Example of threads and Application.Run with two forms
In this code, Main method generate two applications in differents threads
Etiquetas:
application.run,
c#,
start,
system.threading,
threads
Suscribirse a:
Entradas (Atom)