Click here to Skip to main content
15,887,270 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threading for multicore applications Pin
Steven Solberg22-Aug-10 8:57
Steven Solberg22-Aug-10 8:57 
QuestionC# Getting Responce From Form1 Pin
C.CoderCreator21-Aug-10 2:24
C.CoderCreator21-Aug-10 2:24 
AnswerRe: C# Getting Responce From Form1 Pin
Abhinav S21-Aug-10 2:51
Abhinav S21-Aug-10 2:51 
GeneralRe: C# Getting Responce From Form1 Pin
C.CoderCreator21-Aug-10 2:55
C.CoderCreator21-Aug-10 2:55 
AnswerRe: C# Getting Responce From Form1 Pin
venomation21-Aug-10 3:16
venomation21-Aug-10 3:16 
GeneralRe: C# Getting Responce From Form1 Pin
C.CoderCreator21-Aug-10 3:24
C.CoderCreator21-Aug-10 3:24 
GeneralRe: C# Getting Responce From Form1 Pin
venomation21-Aug-10 3:33
venomation21-Aug-10 3:33 
AnswerRe: C# Getting Responce From Form1 Pin
DaveyM6921-Aug-10 6:14
professionalDaveyM6921-Aug-10 6:14 
For the second part of your question: This is the wrong approach. Form2 should NOT be touching controls in Form1 at all.

Instead, assuming Form1 instanciates Form2, Form1 should subscribe to an event raised by Form2.

In Form1
C#
// after instanciating Form2 instance (form2)
form2.RequestUncheckPublicName += form2_RequestUncheckPublicName;

//...

private void form2_RequestUncheckPublicName(object sender, EventArgs e)
{
    // As you are in Form1 you have access to all it's controls without needing to make public, static or other nasty hacks!
    // Do uncheck
}


In Form2
C#
public event EventHandler RequestUncheckPublicName;

private void Time_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyData == Keys.Escape)
    {
        Visible = false;
        OnRequestUncheckPublicName(EventArgs.Empty);
    }
} 
protected virtual void OnRequestUncheckPublicName(EventArgs e)
{
    EventHandler eh = RequestUncheckPublicName;
    if(eh != null)
        eh(this,e);
}

Dave

If this helped, please vote & accept answer!


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

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

GeneralRe: C# Getting Responce From Form1 Pin
Pete O'Hanlon21-Aug-10 7:59
mvePete O'Hanlon21-Aug-10 7:59 
GeneralRe: C# Getting Responce From Form1 Pin
C.CoderCreator21-Aug-10 14:00
C.CoderCreator21-Aug-10 14:00 
GeneralRe: C# Getting Responce From Form1 Pin
Pete O'Hanlon21-Aug-10 21:13
mvePete O'Hanlon21-Aug-10 21:13 
GeneralRe: C# Getting Responce From Form1 Pin
C.CoderCreator21-Aug-10 21:51
C.CoderCreator21-Aug-10 21:51 
GeneralRe: C# Getting Responce From Form1 Pin
Pete O'Hanlon22-Aug-10 3:17
mvePete O'Hanlon22-Aug-10 3:17 
GeneralRe: C# Getting Responce From Form1 Pin
DaveyM6922-Aug-10 4:32
professionalDaveyM6922-Aug-10 4:32 
GeneralRe: C# Getting Responce From Form1 Pin
DaveyM6922-Aug-10 5:14
professionalDaveyM6922-Aug-10 5:14 
GeneralRe: C# Getting Responce From Form1 Pin
Pete O'Hanlon22-Aug-10 5:28
mvePete O'Hanlon22-Aug-10 5:28 
GeneralRe: C# Getting Responce From Form1 Pin
DaveyM6922-Aug-10 5:45
professionalDaveyM6922-Aug-10 5:45 
QuestionWindows service cannot able to start Pin
sekannak21-Aug-10 1:18
sekannak21-Aug-10 1:18 
AnswerRe: Windows service cannot able to start Pin
OriginalGriff21-Aug-10 2:11
mveOriginalGriff21-Aug-10 2:11 
AnswerRe: Windows service cannot able to start Pin
PIEBALDconsult21-Aug-10 4:24
mvePIEBALDconsult21-Aug-10 4:24 
QuestionItems in ComboBox Pin
igalep13221-Aug-10 0:56
igalep13221-Aug-10 0:56 
AnswerRe: Items in ComboBox Pin
Dave Kerr21-Aug-10 1:17
mentorDave Kerr21-Aug-10 1:17 
GeneralRe: Items in ComboBox Pin
igalep13221-Aug-10 1:22
igalep13221-Aug-10 1:22 
QuestionPrintPreview WTF? Pin
Dr.Walt Fair, PE20-Aug-10 16:02
professionalDr.Walt Fair, PE20-Aug-10 16:02 
QuestionEvent Handling in Windows Services [modified] Pin
See_Sharp20-Aug-10 7:27
See_Sharp20-Aug-10 7:27 

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.