Click here to Skip to main content
15,886,673 members
Home / Discussions / C#
   

C#

 
GeneralRe: Arraylist problem!!! Pin
bounik21-Sep-09 22:46
bounik21-Sep-09 22:46 
GeneralRe: Arraylist problem!!! Pin
Amit Patel198521-Sep-09 23:23
Amit Patel198521-Sep-09 23:23 
QuestionExport and save dataset to excel Pin
kdwarak21-Sep-09 17:41
kdwarak21-Sep-09 17:41 
AnswerRe: Export and save dataset to excel Pin
Programm3r21-Sep-09 20:24
Programm3r21-Sep-09 20:24 
GeneralRe: Export and save dataset to excel Pin
kdwarak22-Sep-09 1:16
kdwarak22-Sep-09 1:16 
GeneralRe: Export and save dataset to excel Pin
Programm3r22-Sep-09 1:26
Programm3r22-Sep-09 1:26 
AnswerRe: Export and save dataset to excel Pin
Amit Patel198521-Sep-09 23:35
Amit Patel198521-Sep-09 23:35 
QuestionIs it possible to reconnect an event without raising it? Pin
CBenac21-Sep-09 13:19
CBenac21-Sep-09 13:19 
I have a C# Silverlight 3 app composed of 2 calendar controls. Both have their own SelectedDateChanged event hooked up in the constructor of the class. When user changes the date in one of the controls, the SelectedDateChanged event is raised and some code is executed, mainly to update the SelectedDate property of the other control, but this will also raise the event in the other control as well. I don't want this to happen so, inside the code, before updating the SelectedDate property I disconnect the event in the other control, preventing it to be raised. The problem is that, at the end, when the event is reconnected, it fires, making this logic useless. Is there anyway to do the reconnection without firing the event?

public partial class Page1: UserControl

// Hook events in the Constructor     
public Page1()
         {
            calendarCheckInDate.SelectedDateChanged +=new EventHandler<SelectionChangedEventArgs>calendarCheckInDate_SelectedDateChanged) ;

            calendarCheckOutDate.SelectedDateChanged +=new EventHandler<SelectionChangedEventArgs>(calendarCheckOutDate_SelectedDateChanged);

         }

         // Call event in normal operation
private void calCheckInDate_SelectedDateChanged(object sender,SelectionChangedEventArgs e)
            {
                       
                        // disconnect event on other control
calendarCheckOutDate.SelectedDateChanged -= calendarCheckOutDate_SelectedDateChanged;
                        try
                        {
                           // run some business logic code
                        .....
                        .....
                        calCheckOutDate.SelectedDate.Value =   someothervalue;
                          
                        }
                        catch (Exception ex)
                        {
                              MessageBox.Show(ex.Message);
                        }
                        finally
                        {
                             
                        // Reconnect the event in the other control.
                        // NOTE: THE EVENT WILL BE RAISED HERE
calendarCheckOutDate.SelectedDateChanged += calendarCheckOutDate_SelectedDateChanged;
                        }
                  }
            }
AnswerRe: Is it possible to reconnect an event without raising it? Pin
Gideon Engelberth21-Sep-09 15:54
Gideon Engelberth21-Sep-09 15:54 
GeneralRe: Is it possible to reconnect an event without raising it? Pin
CBenac22-Sep-09 8:30
CBenac22-Sep-09 8:30 
QuestionHow to start a NamedPipeClientStream and a NamedPipeServerStream together Pin
AndyASPVB21-Sep-09 13:19
AndyASPVB21-Sep-09 13:19 
AnswerRe: How to start a NamedPipeClientStream and a NamedPipeServerStream together Pin
Michael Eber22-Sep-09 19:15
Michael Eber22-Sep-09 19:15 
QuestionSilverlight replace elements app Pin
User 602357121-Sep-09 11:14
User 602357121-Sep-09 11:14 
AnswerRe: Silverlight replace elements app Pin
Henry Minute21-Sep-09 11:35
Henry Minute21-Sep-09 11:35 
QuestionProblem with delegate for C++ DLL callback function Pin
Matthew Page21-Sep-09 11:10
Matthew Page21-Sep-09 11:10 
AnswerRe: Problem with delegate for C++ DLL callback function Pin
Matthew Page21-Sep-09 11:54
Matthew Page21-Sep-09 11:54 
QuestionAdding custom properties to a DataGridViewRow Pin
theallmightycpd21-Sep-09 9:33
theallmightycpd21-Sep-09 9:33 
AnswerRe: Adding custom properties to a DataGridViewRow Pin
Henry Minute21-Sep-09 11:41
Henry Minute21-Sep-09 11:41 
GeneralRe: Adding custom properties to a DataGridViewRow Pin
theallmightycpd22-Sep-09 3:39
theallmightycpd22-Sep-09 3:39 
GeneralRe: Adding custom properties to a DataGridViewRow Pin
Henry Minute22-Sep-09 4:08
Henry Minute22-Sep-09 4:08 
QuestionUsing StringBuilder inside another class? Pin
helfri6221-Sep-09 9:27
professionalhelfri6221-Sep-09 9:27 
AnswerRe: Using StringBuilder inside another class? Pin
Luc Pattyn21-Sep-09 9:40
sitebuilderLuc Pattyn21-Sep-09 9:40 
GeneralRe: Using StringBuilder inside another class? Pin
helfri6221-Sep-09 10:00
professionalhelfri6221-Sep-09 10:00 
GeneralRe: Using StringBuilder inside another class? Pin
Luc Pattyn21-Sep-09 10:10
sitebuilderLuc Pattyn21-Sep-09 10:10 
QuestionThread reach synchronized code block Pin
FJJCENTU21-Sep-09 6:33
FJJCENTU21-Sep-09 6:33 

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.