Click here to Skip to main content
15,902,492 members
Home / Discussions / C#
   

C#

 
GeneralRe: DLL Existance Test Pin
Stephen Wickland13-Mar-14 9:25
Stephen Wickland13-Mar-14 9:25 
AnswerRe: DLL Existance Test Pin
Abhinav S15-Mar-14 21:35
Abhinav S15-Mar-14 21:35 
QuestionRead Excel C# windows form using OleDB Connection Pin
Zeyad Jalil12-Mar-14 23:08
professionalZeyad Jalil12-Mar-14 23:08 
AnswerRe: Read Excel C# windows form using OleDB Connection Pin
Bernhard Hiller13-Mar-14 1:10
Bernhard Hiller13-Mar-14 1:10 
GeneralRe: Read Excel C# windows form using OleDB Connection Pin
Zeyad Jalil13-Mar-14 1:56
professionalZeyad Jalil13-Mar-14 1:56 
AnswerRe: Read Excel C# windows form using OleDB Connection Pin
Richard MacCutchan13-Mar-14 2:20
mveRichard MacCutchan13-Mar-14 2:20 
GeneralRe: Read Excel C# windows form using OleDB Connection Pin
Zeyad Jalil13-Mar-14 2:26
professionalZeyad Jalil13-Mar-14 2:26 
GeneralRe: Read Excel C# windows form using OleDB Connection Pin
Richard MacCutchan13-Mar-14 2:44
mveRichard MacCutchan13-Mar-14 2:44 
AnswerRe: Read Excel C# windows form using OleDB Connection Pin
OriginalGriff13-Mar-14 2:59
mveOriginalGriff13-Mar-14 2:59 
GeneralRe: Read Excel C# windows form using OleDB Connection Pin
Eddy Vluggen13-Mar-14 3:59
professionalEddy Vluggen13-Mar-14 3:59 
GeneralRe: Read Excel C# windows form using OleDB Connection Pin
OriginalGriff13-Mar-14 4:51
mveOriginalGriff13-Mar-14 4:51 
QuestionCalling through modem to mobile phone Pin
Akshay41112-Mar-14 1:43
Akshay41112-Mar-14 1:43 
AnswerRe: Calling through modem to mobile phone Pin
jschell12-Mar-14 11:14
jschell12-Mar-14 11:14 
QuestionSend info from XNA-game Pin
larsp77711-Mar-14 22:47
larsp77711-Mar-14 22:47 
SuggestionRe: Send info from XNA-game Pin
Richard MacCutchan11-Mar-14 23:01
mveRichard MacCutchan11-Mar-14 23:01 
GeneralRe: Send info from XNA-game Pin
larsp77711-Mar-14 23:29
larsp77711-Mar-14 23:29 
AnswerRe: Send info from XNA-game Pin
Pete O'Hanlon11-Mar-14 23:04
mvePete O'Hanlon11-Mar-14 23:04 
If one of those is responsible for creating the other, don't new up the original one in the new one. So, if Form1 creates Game1, don't do new Form1() in Game1. That will clear your stack overflow.

Now, as to the second part of your problem. There are a few things you could do to get around this. The first method is to pass a reference to Form1 into the1 Game constructor (or explicitly set it at some point before you try to use Game).
C#
public class Game1 : Game
{
  private Form1 form;
  public Game1(Form1 form)
  {
    this.form = form;
  }
}

public class Form1 : Form
{
  private Game1 game;
  public Form1()
  {
    game = new Game1(this);
  }
}
The other way to do this, and the way I tend to prefer, is to use events in Game1 to signal that Form1 should do something. By using events, you decouple Game1 from having to know anything at all about Form1 - which means you could swap it into other projects far easier. Basically, after you instantiate Game1 in Form1, you can subscribe to the events that you're interested in and use those as appropriate.
GeneralRe: Send info from XNA-game Pin
larsp77711-Mar-14 23:30
larsp77711-Mar-14 23:30 
GeneralRe: Send info from XNA-game Pin
Pete O'Hanlon11-Mar-14 23:35
mvePete O'Hanlon11-Mar-14 23:35 
QuestionChart Control Pin
Subin Mavunkal11-Mar-14 21:39
Subin Mavunkal11-Mar-14 21:39 
AnswerRe: Chart Control Pin
Richard MacCutchan11-Mar-14 22:59
mveRichard MacCutchan11-Mar-14 22:59 
AnswerRe: Chart Control Pin
BillWoodruff12-Mar-14 18:29
professionalBillWoodruff12-Mar-14 18:29 
QuestionHow to display many terminal in other server software ? Pin
Ramkrishn Mishra11-Mar-14 21:15
Ramkrishn Mishra11-Mar-14 21:15 
AnswerRe: How to display many terminal in other server software ? Pin
Richard MacCutchan11-Mar-14 22:58
mveRichard MacCutchan11-Mar-14 22:58 
AnswerRe: How to display many terminal in other server software ? Pin
OriginalGriff11-Mar-14 23:28
mveOriginalGriff11-Mar-14 23:28 

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.