Click here to Skip to main content
15,914,447 members
Home / Discussions / C#
   

C#

 
QuestionDelegates throwing Null Exception Pin
acezrwild81713-Jun-06 7:28
acezrwild81713-Jun-06 7:28 
AnswerRe: Delegates throwing Null Exception Pin
gantww13-Jun-06 7:39
gantww13-Jun-06 7:39 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 7:58
acezrwild81713-Jun-06 7:58 
GeneralRe: Delegates throwing Null Exception Pin
gantww13-Jun-06 8:14
gantww13-Jun-06 8:14 
GeneralRe: Delegates throwing Null Exception Pin
Dustin Metzgar13-Jun-06 8:17
Dustin Metzgar13-Jun-06 8:17 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 8:27
acezrwild81713-Jun-06 8:27 
GeneralRe: Delegates throwing Null Exception Pin
gantww13-Jun-06 8:40
gantww13-Jun-06 8:40 
GeneralRe: Delegates throwing Null Exception Pin
Dustin Metzgar13-Jun-06 8:41
Dustin Metzgar13-Jun-06 8:41 
Use an anonymous method. Here's a code snippet from an MSDN article:

public class SafeLabel : Label
{
   delegate void SetString(string text);
   delegate string GetString();
   override public string Text
   {
      set
      {
         if(InvokeRequired)
         {
            SetString setTextDel = delegate(string text)
                                           {base.Text = text;};
            Invoke(setTextDel,new object[]{value});
         }
         else
            base.Text = value;
      }
      get
      {
         if(InvokeRequired)
         {
            GetString getTextDel = delegate(){return base.Text;};
            return (string)Invoke(getTextDel,null);
         }
         else
            return base.Text;
      }
   }
}




Logifusion[^]
GeneralRe: Delegates throwing Null Exception Pin
gantww13-Jun-06 8:42
gantww13-Jun-06 8:42 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 9:07
acezrwild81713-Jun-06 9:07 
GeneralRe: Delegates throwing Null Exception Pin
Dustin Metzgar13-Jun-06 9:20
Dustin Metzgar13-Jun-06 9:20 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 10:09
acezrwild81713-Jun-06 10:09 
GeneralRe: Delegates throwing Null Exception Pin
Dustin Metzgar13-Jun-06 10:21
Dustin Metzgar13-Jun-06 10:21 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 14:19
acezrwild81713-Jun-06 14:19 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 14:25
acezrwild81713-Jun-06 14:25 
GeneralRe: Delegates throwing Null Exception Pin
gantww14-Jun-06 3:17
gantww14-Jun-06 3:17 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81714-Jun-06 8:14
acezrwild81714-Jun-06 8:14 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 8:53
acezrwild81713-Jun-06 8:53 
GeneralRe: Delegates throwing Null Exception Pin
Judah Gabriel Himango13-Jun-06 9:39
sponsorJudah Gabriel Himango13-Jun-06 9:39 
GeneralRe: Delegates throwing Null Exception Pin
Dustin Metzgar13-Jun-06 10:15
Dustin Metzgar13-Jun-06 10:15 
GeneralRe: Delegates throwing Null Exception Pin
Judah Gabriel Himango13-Jun-06 12:50
sponsorJudah Gabriel Himango13-Jun-06 12:50 
GeneralRe: Delegates throwing Null Exception Pin
Dustin Metzgar13-Jun-06 15:31
Dustin Metzgar13-Jun-06 15:31 
AnswerRe: Delegates throwing Null Exception Pin
Dustin Metzgar13-Jun-06 7:43
Dustin Metzgar13-Jun-06 7:43 
GeneralRe: Delegates throwing Null Exception Pin
gantww13-Jun-06 7:49
gantww13-Jun-06 7:49 
GeneralRe: Delegates throwing Null Exception Pin
acezrwild81713-Jun-06 7:54
acezrwild81713-Jun-06 7: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.