RE: Timer and Random
- From: "veera sekhar kota" <veera sekhar kota@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 11 Jul 2005 01:33:05 -0700
Hi Venu,
OnTimerEvent(object source, EventArgs e), method is not a static method, its
a reference method.
public void OnTimerEvent(object source, EventArgs e)
{
// 8 pictures
Random objRandom= new Random();
int num= objRandom.Next(1,8);
Presentation obj= new Presentation(); /// presentation is the name of
//the class
if(num.ToString()=="1")
{
obj.DisplayCRMInfo(); ///// this function is as below
obj.Refresh();
return;
}
////// 7 more ifs follow
}
try it now ... GoodLuck... Veera Sekhar...
"VenuGopal" wrote:
> hi,
> i have a WELCOME screen. here i have a PICTURE BOX. there are 8 pictures
> that go into this Picture Box.
>
> At every 5 seconds i want to RANDOMLY load a new Picture.
> this is what i am using but it is not loading the new picture.
> Can any one help?
>
>
> public void Presentation_Load(object sender, System.EventArgs e)
> {
> Timer timer1= new Timer();
> timer1.Interval = 5000;
> timer1.Enabled = true;
> timer1.Tick += new System.EventHandler (OnTimerEvent);
> }
>
> public static void OnTimerEvent(object source, EventArgs e)
> {
> // 8 pictures
> Random objRandom= new Random();
> int num= objRandom.Next(1,8);
>
> Presentation obj= new Presentation(); /// presentation is the name of
> the class
> if(num.ToString()=="1")
> {
> obj.DisplayCRMInfo(); ///// this function is as below
> obj.Refresh();
> return;
> }
> ////// 7 more ifs follow
> }
>
> public void DisplayCRMInfo()
> {
> string picture = Application.StartupPath +@"\Presentation\CRM.jpg";
> pictureBox1.Image = Image.FromFile(picture);
> }
>
>
>
.
- References:
- Timer and Random
- From: VenuGopal
- Timer and Random
- Prev by Date: Re: Timer and Random
- Next by Date: Re: Using Graphics.World when drawing
- Previous by thread: Re: Timer and Random
- Next by thread: Re: Timer and Random
- Index(es):
Relevant Pages
|