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

C#

 
GeneralRe: Delay windows power events Pin
Dave Kreskowiak20-Jun-15 5:12
mveDave Kreskowiak20-Jun-15 5:12 
GeneralRe: Delay windows power events Pin
Member 1085025320-Jun-15 5:50
Member 1085025320-Jun-15 5:50 
GeneralRe: Delay windows power events Pin
Dave Kreskowiak20-Jun-15 6:16
mveDave Kreskowiak20-Jun-15 6:16 
GeneralRe: Delay windows power events Pin
Member 1085025320-Jun-15 7:28
Member 1085025320-Jun-15 7:28 
GeneralRe: Delay windows power events Pin
Dave Kreskowiak20-Jun-15 7:38
mveDave Kreskowiak20-Jun-15 7:38 
GeneralRe: Delay windows power events Pin
Member 1085025320-Jun-15 7:59
Member 1085025320-Jun-15 7:59 
GeneralRe: Delay windows power events Pin
Member 1085025320-Jun-15 1:34
Member 1085025320-Jun-15 1:34 
QuestionInheritance Pin
JammoD8719-Jun-15 11:35
JammoD8719-Jun-15 11:35 
Hi,

I want to load a screen with a ViewModel depending on the option selected.

I thought Inheritance would be key here, as a lot of the properties are the same. Below is an extract of the code that I have.

C#
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            bool isHandheld = false;

            var pdv1 = isHandheld == true ? new PDVHH() : new PDV();

            txtCaseID.Text = pdv1.CaseID;
            txtPDV.Text = isHandheld == true ? pdv1.PDVString : string.Empty;
            txtPDVHH.Text = isHandheld == true ? pdv1.PDVHHString : string.Empty;

        }
    }

    class basePDV
    {
        public string CaseID { get; set; }
    }

    class PDV : basePDV
    {
        public string PDVString { get; set; }
    }

    class PDVHH : basePDV
    {
        public string PDVHHString { get; set; }
    }


The error I am receiving is... "Type of conditional expression cannot be determined because there is no implicit conversion between 'WindowsFormsApplication1.PDVHH' and 'WindowsFormsApplication1.PDV'"

I'm hoping someone can give me some guidance on a solution for this.

Thanks,
Personal Blog: A Software Programmer
Twitter: JammoD

AnswerRe: Inheritance Pin
harold aptroot19-Jun-15 11:44
harold aptroot19-Jun-15 11:44 
GeneralRe: Inheritance Pin
JammoD8719-Jun-15 11:46
JammoD8719-Jun-15 11:46 
GeneralRe: Inheritance Pin
harold aptroot19-Jun-15 11:51
harold aptroot19-Jun-15 11:51 
SuggestionRe: Inheritance Pin
Sascha Lefèvre19-Jun-15 12:53
professionalSascha Lefèvre19-Jun-15 12:53 
AnswerRe: Inheritance Pin
JammoD8719-Jun-15 21:26
JammoD8719-Jun-15 21:26 
QuestionC# need 2 threads for long execution Pin
dracebus19-Jun-15 8:48
dracebus19-Jun-15 8:48 
AnswerRe: C# need 2 threads for long execution Pin
PIEBALDconsult19-Jun-15 8:59
mvePIEBALDconsult19-Jun-15 8:59 
GeneralRe: C# need 2 threads for long execution Pin
dracebus19-Jun-15 9:02
dracebus19-Jun-15 9:02 
GeneralRe: C# need 2 threads for long execution Pin
PIEBALDconsult19-Jun-15 9:12
mvePIEBALDconsult19-Jun-15 9:12 
GeneralRe: C# need 2 threads for long execution Pin
Dave Kreskowiak19-Jun-15 9:21
mveDave Kreskowiak19-Jun-15 9:21 
GeneralRe: C# need 2 threads for long execution Pin
Philippe Mori19-Jun-15 16:20
Philippe Mori19-Jun-15 16:20 
QuestionTrying to sum several fields into a total field Pin
Norris Chappell18-Jun-15 16:17
Norris Chappell18-Jun-15 16:17 
AnswerRe: Trying to sum several fields into a total field Pin
OriginalGriff18-Jun-15 19:15
mveOriginalGriff18-Jun-15 19:15 
GeneralRe: Trying to sum several fields into a total field Pin
Norris Chappell18-Jun-15 20:26
Norris Chappell18-Jun-15 20:26 
GeneralRe: Trying to sum several fields into a total field Pin
Norris Chappell18-Jun-15 20:31
Norris Chappell18-Jun-15 20:31 
GeneralRe: Trying to sum several fields into a total field Pin
Pete O'Hanlon18-Jun-15 22:39
mvePete O'Hanlon18-Jun-15 22:39 
GeneralRe: Trying to sum several fields into a total field Pin
Norris Chappell19-Jun-15 4:44
Norris Chappell19-Jun-15 4:44 

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.