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

C#

 
QuestionPassing a Method to a second form Pin
bwood20209-Jul-09 7:13
bwood20209-Jul-09 7:13 
AnswerRe: Passing a Method to a second form Pin
harold aptroot9-Jul-09 7:25
harold aptroot9-Jul-09 7:25 
GeneralRe: Passing a Method to a second form Pin
bwood20209-Jul-09 7:28
bwood20209-Jul-09 7:28 
GeneralRe: Passing a Method to a second form Pin
harold aptroot9-Jul-09 7:35
harold aptroot9-Jul-09 7:35 
GeneralRe: Passing a Method to a second form Pin
bwood20209-Jul-09 7:38
bwood20209-Jul-09 7:38 
AnswerRe: Passing a Method to a second form Pin
DaveyM699-Jul-09 7:32
professionalDaveyM699-Jul-09 7:32 
GeneralRe: Passing a Method to a second form Pin
bwood20209-Jul-09 7:47
bwood20209-Jul-09 7:47 
AnswerRe: Passing a Method to a second form Pin
Patrik.karlin9-Jul-09 7:38
Patrik.karlin9-Jul-09 7:38 
Hej bwood2020

You Migth whant to use a static resource that can laungh that form1 passes an event to


static class EventHandler
    {
        static Action Event; // the global state
        public static void SetGlobalEvent(Action a) // Setts the event
        {
            Event = a;
        }
        public static void Execute_Event() // Execute the event
        {
            Event();
        }


    }

    class Form1
    {
        public Form1()
        {
            EventHandler.SetGlobalEvent(Event); // Sett the event
        }

        public void Event() // The events that going to be executet
        {
            var x = 2 + 2;
        }
    }

    class Form2
    {
        public void Onclick()
        {
            EventHandler.Execute_Event(); // Execute the event
            this.Destroy(); // Destroy your form ( or close )
        }
    }


There migth be a bether way of doing this if form1 creates form2 you can pass
in "this" from form1 as a parameter that way form2 whill be able to call the method on that object

Hopes this helps Patrik
GeneralRe: Passing a Method to a second form Pin
DaveyM699-Jul-09 7:46
professionalDaveyM699-Jul-09 7:46 
GeneralRe: Passing a Method to a second form Pin
Patrik.karlin9-Jul-09 8:11
Patrik.karlin9-Jul-09 8:11 
GeneralRe: Passing a Method to a second form Pin
Henry Minute9-Jul-09 9:39
Henry Minute9-Jul-09 9:39 
GeneralRe: Passing a Method to a second form Pin
bwood20209-Jul-09 10:21
bwood20209-Jul-09 10:21 
Question[Message Deleted] Pin
VivekUtsa9-Jul-09 7:05
VivekUtsa9-Jul-09 7:05 
AnswerRe: Browser compatability Issues Pin
Dave Kreskowiak9-Jul-09 7:46
mveDave Kreskowiak9-Jul-09 7:46 
GeneralRe: Browser compatability Issues Pin
Manas Bhardwaj9-Jul-09 8:33
professionalManas Bhardwaj9-Jul-09 8:33 
QuestionHow do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" Pin
Vengeful Emus9-Jul-09 6:56
Vengeful Emus9-Jul-09 6:56 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" Pin
harold aptroot9-Jul-09 7:20
harold aptroot9-Jul-09 7:20 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" Pin
Vengeful Emus9-Jul-09 7:38
Vengeful Emus9-Jul-09 7:38 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" [modified*2] Pin
harold aptroot9-Jul-09 7:44
harold aptroot9-Jul-09 7:44 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" [modified*2] Pin
Dave Kreskowiak9-Jul-09 10:31
mveDave Kreskowiak9-Jul-09 10:31 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" Pin
harold aptroot9-Jul-09 10:39
harold aptroot9-Jul-09 10:39 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" [modified] Pin
Dave Kreskowiak9-Jul-09 7:51
mveDave Kreskowiak9-Jul-09 7:51 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" Pin
harold aptroot9-Jul-09 8:05
harold aptroot9-Jul-09 8:05 
GeneralRe: How do I retreive and interface's IP Address(es) when starting only with "Friendly Adapter Name" Pin
Luc Pattyn9-Jul-09 9:20
sitebuilderLuc Pattyn9-Jul-09 9:20 
Questionsearch for nearby wifi networks Pin
Vivek Vijayan9-Jul-09 6:54
Vivek Vijayan9-Jul-09 6:54 

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.