Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Sql INSERT statment Pin
vincent.reynolds9-Jun-05 5:50
vincent.reynolds9-Jun-05 5:50 
QuestionListView multiline items? Pin
george ivanov8-Jun-05 22:58
george ivanov8-Jun-05 22:58 
AnswerRe: ListView multiline items? Pin
Philip Price8-Jun-05 23:18
Philip Price8-Jun-05 23:18 
AnswerRe: ListView multiline items? Pin
Dave Kreskowiak9-Jun-05 6:32
mveDave Kreskowiak9-Jun-05 6:32 
GeneralPlease Help! Function on Separate Form Pin
DJdC8-Jun-05 22:56
DJdC8-Jun-05 22:56 
GeneralRe: Please Help! Function on Separate Form Pin
Carsten Zeumer8-Jun-05 23:19
Carsten Zeumer8-Jun-05 23:19 
GeneralCadi's Solution Pin
DJdC8-Jun-05 23:45
DJdC8-Jun-05 23:45 
GeneralRe: Cadi's Solution Pin
Carsten Zeumer9-Jun-05 0:03
Carsten Zeumer9-Jun-05 0:03 
Ok... so form1 is not the owner of form2 (ok, if it would be like this the Owner property would have been ok...)
Hmm... this leeds me to a second aproach.
If both forms have the same owner then you could search for form1 using something like this: this.FindForm().OwnedForms

If there is always only ONE instance of form1 you could try somthing like this:
public class Form1 : System.Windows.Form
{
   private static Form1 m_GlobalInstance;
   public Form1()
   { 
     // set global instance
     m_GlobalInstance = this;
   }
 
  protected override void OnClosed(EventArgs e)
   {
     // invalidate global instance
      m_GlobalInstance = null;
      base.OnClosed (e);
  }

  // ....
   
   // property to access global instance
   public static Form1 GlobalInstance
   {
     return m_GlobalInstance;
   }

}

public class Form2 : System.Windows.Form
{
  // ....
  public void SomeFunctionUsingComponentsOnForm1()  
  {
      if (Form1.GlobalInstance == null)
         throw new ArgumentException("Form1 is not yet created.");
      Form1.GlobalInstance.components();  
   }
}


/cadi

24 hours is not enough
GeneralRe: Please Help! Function on Separate Form Pin
S. Senthil Kumar8-Jun-05 23:21
S. Senthil Kumar8-Jun-05 23:21 
GeneralSenthil's Solution Pin
DJdC8-Jun-05 23:41
DJdC8-Jun-05 23:41 
GeneralRe: Please Help! Function on Separate Form Pin
Christian Graus9-Jun-05 0:52
protectorChristian Graus9-Jun-05 0:52 
GeneralGet reference to Form1. Pin
Khoa Bui9-Jun-05 3:05
Khoa Bui9-Jun-05 3:05 
GeneralRe: Get reference to Form1. Pin
Dave Kreskowiak9-Jun-05 6:29
mveDave Kreskowiak9-Jun-05 6:29 
GeneralRe: Get reference to Form1. Pin
Christian Graus9-Jun-05 11:18
protectorChristian Graus9-Jun-05 11:18 
GeneralRe: Get reference to Form1. Pin
Dave Kreskowiak9-Jun-05 14:55
mveDave Kreskowiak9-Jun-05 14:55 
GeneralRe: Get reference to Form1. Pin
Christian Graus9-Jun-05 14:58
protectorChristian Graus9-Jun-05 14:58 
GeneralRe: Get reference to Form1. Pin
Dave Kreskowiak9-Jun-05 16:13
mveDave Kreskowiak9-Jun-05 16:13 
GeneralRe: Get reference to Form1. Pin
Christian Graus9-Jun-05 16:16
protectorChristian Graus9-Jun-05 16:16 
GeneralReply to Dave's Solution Pin
DJdC9-Jun-05 15:42
DJdC9-Jun-05 15:42 
GeneralRe: Reply to Dave's Solution Pin
Dave Kreskowiak9-Jun-05 16:16
mveDave Kreskowiak9-Jun-05 16:16 
GeneralRe: Reply to Dave's Solution Pin
Christian Graus9-Jun-05 16:17
protectorChristian Graus9-Jun-05 16:17 
GeneralRe: Reply to Dave's Solution Pin
Dave Kreskowiak10-Jun-05 1:32
mveDave Kreskowiak10-Jun-05 1:32 
GeneralRe: Reply to Dave's Solution Pin
Christian Graus13-Jun-05 12:10
protectorChristian Graus13-Jun-05 12:10 
GeneralReply to Fantas's Solution Pin
DJdC9-Jun-05 15:37
DJdC9-Jun-05 15:37 
GeneralRe: Reply to Fantas's Solution Pin
Christian Graus9-Jun-05 16:21
protectorChristian Graus9-Jun-05 16:21 

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.