Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
AnswerRe: save time with the desired date Pin
Richard MacCutchan7-May-13 21:06
mveRichard MacCutchan7-May-13 21:06 
QuestionUser defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
PozzaVecia7-May-13 11:02
PozzaVecia7-May-13 11:02 
AnswerRe: User defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
Dave Kreskowiak7-May-13 15:10
mveDave Kreskowiak7-May-13 15:10 
AnswerRe: User defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
PozzaVecia7-May-13 18:48
PozzaVecia7-May-13 18:48 
GeneralRe: User defined functions for Excel 2010 in .NET: args linked to cells don't work Pin
Dave Kreskowiak8-May-13 2:14
mveDave Kreskowiak8-May-13 2:14 
QuestionSolution Explorer to be shown on the toolbar Pin
indian1437-May-13 7:15
indian1437-May-13 7:15 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Dave Kreskowiak7-May-13 7:41
mveDave Kreskowiak7-May-13 7:41 
GeneralRe: Solution Explorer to be shown on the toolbar Pin
T Pat7-May-13 20:00
T Pat7-May-13 20:00 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Pete O'Hanlon7-May-13 8:16
mvePete O'Hanlon7-May-13 8:16 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Anna King8-May-13 3:07
professionalAnna King8-May-13 3:07 
GeneralRe: Solution Explorer to be shown on the toolbar Pin
Pete O'Hanlon8-May-13 3:47
mvePete O'Hanlon8-May-13 3:47 
QuestionBackground worker with progress bar timing issue Pin
Blubbo7-May-13 5:02
Blubbo7-May-13 5:02 
AnswerRe: Background worker with progress bar timing issue Pin
Eddy Vluggen7-May-13 9:28
professionalEddy Vluggen7-May-13 9:28 
AnswerRe: Background worker with progress bar timing issue Pin
Matt T Heffron7-May-13 11:31
professionalMatt T Heffron7-May-13 11:31 
GeneralRe: Background worker with progress bar timing issue Pin
Blubbo8-May-13 8:18
Blubbo8-May-13 8:18 
SuggestionRe: Background worker with progress bar timing issue Pin
Matt T Heffron8-May-13 8:50
professionalMatt T Heffron8-May-13 8:50 
I think you should just create the delegate once as it doesn't change. And the BeginInvoke's second argument is params so it will assemble the object array automatically, so this might be easier to read:
C#
private static Action<ProgressBar, int> UpdateProgressBarAction = UpdateProgressBar;
private static void UpdateProgressBar(ProgressBar pb, int value)
{
  if (pb.InvokeRequired)
  {
    pb.BeginInvoke(UpdateProgressBarAction, pb, value);
  }
  else
    pb.Value = value;
}

You could even use a lambda to define this self-referentially to avoid the separate UpdateProgressBarAction:
C#
private static Action<ProgressBar, int> UpdateProgressBar = (ProgressBar pb, int value) => {
  if (pb.InvokeRequired)
  {
    pb.BeginInvoke(UpdateProgressBar, pb, value);
  }
  else
    pb.Value = value;
};

GeneralRe: Background worker with progress bar timing issue Pin
Blubbo8-May-13 9:11
Blubbo8-May-13 9:11 
Questionnetwork programming Pin
Member 100297487-May-13 4:53
Member 100297487-May-13 4:53 
AnswerRe: network programming Pin
Richard MacCutchan7-May-13 4:59
mveRichard MacCutchan7-May-13 4:59 
GeneralRe: network programming Pin
Ennis Ray Lynch, Jr.7-May-13 7:33
Ennis Ray Lynch, Jr.7-May-13 7:33 
GeneralRe: network programming Pin
Richard MacCutchan7-May-13 20:34
mveRichard MacCutchan7-May-13 20:34 
AnswerRe: network programming Pin
Anna King8-May-13 3:19
professionalAnna King8-May-13 3:19 
QuestionEthernet Port C# Pin
Member 100344047-May-13 2:28
Member 100344047-May-13 2:28 
AnswerRe: Ethernet Port C# Pin
Richard MacCutchan7-May-13 2:51
mveRichard MacCutchan7-May-13 2:51 
QuestionSaving objects with Cross-reference Pin
larsp7777-May-13 1:35
larsp7777-May-13 1:35 

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.