Click here to Skip to main content
15,912,977 members
Home / Discussions / C#
   

C#

 
GeneralRe: WM_LBUTTONDOWN Message Pin
Heath Stewart17-Jun-04 17:11
protectorHeath Stewart17-Jun-04 17:11 
GeneralRe: WM_LBUTTONDOWN Message Pin
Guinness4Strength18-Jun-04 2:58
Guinness4Strength18-Jun-04 2:58 
GeneralRe: WM_LBUTTONDOWN Message Pin
Heath Stewart18-Jun-04 3:44
protectorHeath Stewart18-Jun-04 3:44 
GeneralContext Menu Help Pin
StephenMcAllister17-Jun-04 9:48
StephenMcAllister17-Jun-04 9:48 
GeneralRe: Context Menu Help Pin
LongRange.Shooter17-Jun-04 10:47
LongRange.Shooter17-Jun-04 10:47 
GeneralRe: Context Menu Help Pin
Heath Stewart17-Jun-04 17:17
protectorHeath Stewart17-Jun-04 17:17 
QuestionVB6 Modules =? in C# ??? Pin
antoine@orchus-tech17-Jun-04 9:31
antoine@orchus-tech17-Jun-04 9:31 
AnswerRe: VB6 Modules =? in C# ??? Pin
Judah Gabriel Himango17-Jun-04 9:43
sponsorJudah Gabriel Himango17-Jun-04 9:43 
Pass a reference of the Form instance to the class you want to modify. For example,

// in the Form class, MyForm.cs
OtherClass theOtherClass = new OtherClass(this);

// in the other class
public class OtherClass
{
   MyForm myFormInstance = null;
   
   public OtherClass(MyForm frmInst)
   {
      this.myFormInstance = frmInst;

      this.myFormInstance.DoSomething();
   }
}


Of course you can always make your Form class have a public static variable to make it accessible from other classes, like so:

public class MyForm : Form
{
   public static MyForm TheFormInstance = null;

   public MyForm()
   {
      TheFormInstance = this;
   }
}

// in some other class (note that MyForm is the actual name of the class, not a class instance)
MyForm.TheFormInstance.DoSomething();


Now as far as using the singleton pattern above, Heath or some other very talented developer will chide me for not mentioning the correct way to do it (when using multiple threads and such). But the above code should suffice if you're just using one Form instance. Smile | :)

#include "witty_sig.h"
GeneralRe: VB6 Modules =? in C# ??? Pin
antoine@orchus-tech17-Jun-04 10:03
antoine@orchus-tech17-Jun-04 10:03 
GeneralRe: VB6 Modules =? in C# ??? Pin
Judah Gabriel Himango17-Jun-04 10:10
sponsorJudah Gabriel Himango17-Jun-04 10:10 
AnswerRe: VB6 Modules =? in C# ??? Pin
LongRange.Shooter17-Jun-04 10:55
LongRange.Shooter17-Jun-04 10:55 
GeneralUnsafe code in user control Pin
Shree17-Jun-04 6:56
Shree17-Jun-04 6:56 
GeneralRe: Unsafe code in user control Pin
Dave Kreskowiak17-Jun-04 7:03
mveDave Kreskowiak17-Jun-04 7:03 
GeneralRe: Unsafe code in user control Pin
Shree17-Jun-04 7:09
Shree17-Jun-04 7:09 
GeneralRe: Unsafe code in user control Pin
Dave Kreskowiak17-Jun-04 8:00
mveDave Kreskowiak17-Jun-04 8:00 
Generalcustom control ide properties "items" question Pin
FocusedWolf17-Jun-04 6:54
FocusedWolf17-Jun-04 6:54 
GeneralRe: custom control ide properties "items" question Pin
LongRange.Shooter17-Jun-04 10:57
LongRange.Shooter17-Jun-04 10:57 
GeneralRe: custom control ide properties "items" question Pin
FocusedWolf21-Jun-04 4:35
FocusedWolf21-Jun-04 4:35 
QuestionHow to operate USB port Pin
wk_vigorous17-Jun-04 6:27
wk_vigorous17-Jun-04 6:27 
AnswerRe: How to operate USB port Pin
Aaron Eldreth17-Jun-04 6:46
Aaron Eldreth17-Jun-04 6:46 
GeneralRe: How to operate USB port Pin
eggie517-Jun-04 18:13
eggie517-Jun-04 18:13 
AnswerRe: How to operate USB port Pin
Dave Kreskowiak17-Jun-04 6:54
mveDave Kreskowiak17-Jun-04 6:54 
AnswerRe: How to operate USB port Pin
eggie517-Jun-04 18:14
eggie517-Jun-04 18:14 
GeneralRe: How to operate USB port Pin
wk_vigorous17-Jun-04 21:46
wk_vigorous17-Jun-04 21:46 
GeneralRe: How to operate USB port Pin
eggie517-Jun-04 22:06
eggie517-Jun-04 22:06 

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.