What is this error?


Author
Message
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
That's very odd... I've never heard of .NET not being able to cast an object to its own type.
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I think that I tried that and got the same message. The only thing that worked was

DateTime.Parse(bo.NullableGenericDate.Value.ToShortDateString()).
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
When you pass a nullable generic from a property, you will need to pass the propertie's .Value member.  Like this:

new PatientSelectedEventArgs(boPatientSearch1.MRN, boPatientSearch1.LASTNAME, boPatientSearch1.FIRSTNAME, boPatientSearch1.BIRTHDATE.Value, boPatientSearch1.GENDER, boPatientSearch1.SSN);

Otherwise, you're passing a NullableGeneric value into an actual value.

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
yes, nullable generic
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Are you returning a nullable generic value for the DateTime?  If not, what is the value of the variable you're trying to pass?
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
In this code tha references a bo:

PatientSelectedEventArgs pa = new PatientSelectedEventArgs(boPatientSearch1.MRN, boPatientSearch1.LASTNAME, boPatientSearch1.FIRSTNAME, boPatientSearch1.BIRTHDATE, boPatientSearch1.GENDER, boPatientSearch1.SSN);



with this set of event args:

public class PatientSelectedEventArgs : EventArgs

{

public PatientSelectedEventArgs(string MRN, string LastName, string FirstName, DateTime Birthdate, string Gender, string SSN)

{

this.MRN = MRN;

this.LastName = LastName;

this.FirstName = FirstName;

this.SSN = SSN;

this.Gender = Gender;

this.Birthdate = Birthdate;

this.IDSTRING = "MRN: " + MRN + ", Name: " + LastName + ", " + FirstName + ", Gender: " + Gender + ", Birthdate: " + Birthdate.ToShortDateString();

}

public string MRN;

public string IDSTRING;

public string LastName;

public string FirstName;

public string Gender;

public string SSN;

public DateTime Birthdate;

}





what is this?

Argument '4': cannot convert from 'System.DateTime?' to 'System.DateTime'   

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search