Click here to Skip to main content
15,893,588 members
Home / Discussions / C#
   

C#

 
GeneralRe: Converting Back from Bit to Byte Pin
computerpublic13-Mar-14 8:16
computerpublic13-Mar-14 8:16 
AnswerRe: Converting Back from Decimal to Byte Pin
Eddy Vluggen12-Feb-14 11:21
professionalEddy Vluggen12-Feb-14 11:21 
QuestionRe: Converting Back from Decimal to Byte Pin
Richard MacCutchan12-Feb-14 21:38
mveRichard MacCutchan12-Feb-14 21:38 
Questiontreeview and database Pin
danmor49812-Feb-14 6:45
danmor49812-Feb-14 6:45 
QuestionRe: treeview and database Pin
Ravi Bhavnani12-Feb-14 7:28
professionalRavi Bhavnani12-Feb-14 7:28 
AnswerRe: treeview and database Pin
danmor49812-Feb-14 7:52
danmor49812-Feb-14 7:52 
QuestionRe: treeview and database Pin
Richard MacCutchan12-Feb-14 21:27
mveRichard MacCutchan12-Feb-14 21:27 
AnswerRe: treeview and database Pin
danmor49813-Feb-14 8:58
danmor49813-Feb-14 8:58 
GeneralRe: treeview and database Pin
Richard MacCutchan13-Feb-14 21:45
mveRichard MacCutchan13-Feb-14 21:45 
QuestionASP.NET Project Files Pin
Sandhya Bandar12-Feb-14 2:29
Sandhya Bandar12-Feb-14 2:29 
AnswerRe: ASP.NET Project Files Pin
Richard MacCutchan12-Feb-14 4:42
mveRichard MacCutchan12-Feb-14 4:42 
QuestionThe file version maintain utility Pin
sahani from india12-Feb-14 1:56
sahani from india12-Feb-14 1:56 
AnswerRe: The file version maintain utility Pin
Pete O'Hanlon12-Feb-14 2:16
mvePete O'Hanlon12-Feb-14 2:16 
GeneralRe: The file version maintain utility Pin
OriginalGriff14-Feb-14 22:27
mveOriginalGriff14-Feb-14 22:27 
QuestionHelp needed XNA and Window Forms Pin
larsp77712-Feb-14 0:57
larsp77712-Feb-14 0:57 
AnswerRe: Help needed XNA and Window Forms Pin
DaveyM6912-Feb-14 1:09
professionalDaveyM6912-Feb-14 1:09 
GeneralRe: Help needed XNA and Window Forms Pin
larsp77712-Feb-14 1:13
larsp77712-Feb-14 1:13 
GeneralRe: Help needed XNA and Window Forms Pin
DaveyM6912-Feb-14 1:39
professionalDaveyM6912-Feb-14 1:39 
C#
Form1 form = new Form1();
form.Show();
Game1 game = new Game1(form.getDrawSurface());
form.Game = game;  //The new line 
game.GameEvent += HandleGameEvent;
game.Run();

// Inside Form1
private void HandleGameEvent(object sender, EventArgs e)
{
 //
}

public class Game1
{
 public event EventHandler GameEvent;

 protected vitual void OnGameEvent(EventArgs e)
 {
  EventHandler eh = GameEvent;
  if(eh != null)
   eh(this, e);
 }
}

Check out Basic Event Creation in C#[^] and Events Made Simple[^]
Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



GeneralRe: Help needed XNA and Window Forms Pin
larsp77712-Feb-14 4:34
larsp77712-Feb-14 4:34 
GeneralRe: Help needed XNA and Window Forms Pin
Pete O'Hanlon12-Feb-14 4:50
mvePete O'Hanlon12-Feb-14 4:50 
AnswerRe: Help needed XNA and Window Forms Pin
Marco Bertschi12-Feb-14 1:40
protectorMarco Bertschi12-Feb-14 1:40 
QuestionRegEx problem with Escape sequences Pin
Marco Bertschi11-Feb-14 23:30
protectorMarco Bertschi11-Feb-14 23:30 
SuggestionRe: RegEx problem with Escape sequences Pin
Kornfeld Eliyahu Peter11-Feb-14 23:39
professionalKornfeld Eliyahu Peter11-Feb-14 23:39 
GeneralRe: RegEx problem with Escape sequences Pin
Marco Bertschi11-Feb-14 23:53
protectorMarco Bertschi11-Feb-14 23:53 
GeneralRe: RegEx problem with Escape sequences Pin
Kornfeld Eliyahu Peter11-Feb-14 23:57
professionalKornfeld Eliyahu Peter11-Feb-14 23:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.