Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to not display the a row based on a condition. Pin
Norris Chappell4-Jun-15 3:54
Norris Chappell4-Jun-15 3:54 
QuestionRe: How to not display the a row based on a condition. Pin
Agent__0073-Jun-15 18:41
professionalAgent__0073-Jun-15 18:41 
AnswerRe: How to not display the a row based on a condition. Pin
Agent__0077-Jun-15 18:46
professionalAgent__0077-Jun-15 18:46 
GeneralRe: How to not display the a row based on a condition. Pin
Norris Chappell8-Jun-15 5:47
Norris Chappell8-Jun-15 5:47 
GeneralRe: How to not display the a row based on a condition. Pin
Richard Deeming8-Jun-15 6:49
mveRichard Deeming8-Jun-15 6:49 
GeneralRe: How to not display the a row based on a condition. Pin
Norris Chappell8-Jun-15 8:34
Norris Chappell8-Jun-15 8:34 
QuestionClass Hierarchy Design Question Pin
Kevin Marois3-Jun-15 12:44
professionalKevin Marois3-Jun-15 12:44 
AnswerRe: Class Hierarchy Design Question Pin
Richard Deeming3-Jun-15 21:40
mveRichard Deeming3-Jun-15 21:40 
If you're subscribing to the event when you create the control, you just need a local variable of the correct type:
C#
case AppMode.Discover:
    var view = new ConnectionView();
    view.ConnectedToDevice += YourEventHandler;
    CurrentView = view;
    CurrentView.Load();
    break;


If you want to subscribe at some other point, the as operator would work:
C#
var connectionView = CurrentView as IConnectionView;
if (connectionView != null)
{
    connectionView.ConnectedToDevice += YourEventHandler;
}


NB: There's a subtle race-condition in your RaisePropertyChanged method. It's possible that the last subscriber could be removed between the not-null check and the invocation. The simplest fix is to copy the delegate to a local variable at the start:
C#
protected void RaisePropertyChanged(string propertyName)
{
    var handler = PropertyChanged;
    if (handler != null)
    {
        handler(this, new PropertyChangedEventArgs(propertyName));
    }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Class Hierarchy Design Question Pin
Kevin Marois4-Jun-15 4:27
professionalKevin Marois4-Jun-15 4:27 
QuestionC# PDF Printing Pin
El Developer3-Jun-15 4:54
El Developer3-Jun-15 4:54 
AnswerRe: C# PDF Printing Pin
Pete O'Hanlon3-Jun-15 5:01
mvePete O'Hanlon3-Jun-15 5:01 
GeneralRe: C# PDF Printing Pin
El Developer3-Jun-15 5:10
El Developer3-Jun-15 5:10 
GeneralRe: C# PDF Printing Pin
Pete O'Hanlon3-Jun-15 5:14
mvePete O'Hanlon3-Jun-15 5:14 
GeneralRe: C# PDF Printing Pin
El Developer3-Jun-15 5:30
El Developer3-Jun-15 5:30 
GeneralRe: C# PDF Printing Pin
Pete O'Hanlon3-Jun-15 5:56
mvePete O'Hanlon3-Jun-15 5:56 
QuestionStack exchange redis with .NetFramework 4.0 c# Pin
Member 104597132-Jun-15 23:59
Member 104597132-Jun-15 23:59 
AnswerRe: Stack exchange redis with .NetFramework 4.0 c# Pin
Mycroft Holmes3-Jun-15 14:31
professionalMycroft Holmes3-Jun-15 14:31 
GeneralRe: Stack exchange redis with .NetFramework 4.0 c# Pin
Member 104597134-Jun-15 23:21
Member 104597134-Jun-15 23:21 
Questionhow to fill textbox with DGV Column ? Pin
Member 115798702-Jun-15 22:24
Member 115798702-Jun-15 22:24 
AnswerRe: how to fill textbox with DGV Column ? Pin
OriginalGriff2-Jun-15 22:38
mveOriginalGriff2-Jun-15 22:38 
GeneralRe: how to fill textbox with DGV Column ? Pin
Member 115798702-Jun-15 22:45
Member 115798702-Jun-15 22:45 
GeneralRe: how to fill textbox with DGV Column ? Pin
OriginalGriff2-Jun-15 22:52
mveOriginalGriff2-Jun-15 22:52 
GeneralRe: how to fill textbox with DGV Column ? Pin
Member 115798702-Jun-15 23:02
Member 115798702-Jun-15 23:02 
GeneralRe: how to fill textbox with DGV Column ? Pin
OriginalGriff2-Jun-15 23:05
mveOriginalGriff2-Jun-15 23:05 
GeneralRe: how to fill textbox with DGV Column ? Pin
Member 115798702-Jun-15 23:27
Member 115798702-Jun-15 23: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.