PDA

View Full Version : C# Help



Invent
26-11-2007, 07:48 PM
Hi,

To get a better understanding of C#, I've started developing my own Habbo Retro Server (only for educational purposes).

I've got all the basics completed and now I'm starting to develop the php side of the retro.

I've decided to create a houskeeping system to go with the server and so this is why I need help.

In the backend I am going to have a Packet send feature which just inserts specified packets into an SQL Table.

I need help because I don't know how to keep running a function every 5 seconds or so (in C#). I need to run an SQL Query in C# every 5/10 seconds to check for any data in the SQL Table (and if there is, send the data).

How would I go around repeating the function every 5 seconds?

Thanks if you can help,
-Simon

Splinter
26-11-2007, 08:28 PM
Try something along these lines:




Timer Clock;
Label lbTime=new Label();

public TimerDemo()
{
Clock=new Timer();
Clock.Interval=1000;
Clock.Start();
Clock.Tick+=new EventHandler(*FUNCTION*); }




Just replace *FUNCTION* with the relevant function.

Hypertext
02-02-2008, 02:17 AM
That looks to work,tbh simon not many people no C# here -i'd try a different forum :P - i'm only just learning it :P I wrote a calculator =DDDDD

Want to hide these adverts? Register an account for free!