Click here to Skip to main content
15,921,028 members
Home / Discussions / C#
   

C#

 
QuestionPassing objects as parameters Pin
adol_w11-Apr-06 5:11
adol_w11-Apr-06 5:11 
AnswerRe: Passing objects as parameters Pin
J4amieC11-Apr-06 5:16
J4amieC11-Apr-06 5:16 
QuestionRe: Passing objects as parameters Pin
adol_w11-Apr-06 5:40
adol_w11-Apr-06 5:40 
AnswerRe: Passing objects as parameters Pin
majed sultan11-Apr-06 6:25
majed sultan11-Apr-06 6:25 
GeneralRe: Passing objects as parameters Pin
Leyu11-Apr-06 6:57
Leyu11-Apr-06 6:57 
AnswerRe: Passing objects as parameters Pin
Stefan Troschuetz11-Apr-06 7:12
Stefan Troschuetz11-Apr-06 7:12 
GeneralRe: Passing objects as parameters Pin
adol_w11-Apr-06 8:43
adol_w11-Apr-06 8:43 
QuestionDateTime Pin
Brendan Vogt11-Apr-06 4:33
Brendan Vogt11-Apr-06 4:33 
Hi,

How does one assign a "no value" to a DateTime object. Assign it null won't work because it's a value type.

The reson why I ask is because I have a function, that would check a date value, if it is "no value", the return DBNULL.Value, or return the value of the string. This is for database insertion.

Currently I have the following:

DateTime objDOB;
if (txtYY.Text == string.Empty || txtMM.Text == string.Empty || txtDD.Text == string.Empty)
objDOB = new DateTime(1800, 01, 01); // Default "blank" date
else
objDOB = new DateTime(Int32.Parse(txtYY.Text), Int32.Parse(txtMM.Text), Int32.Parse(txtDD.Text));

I would have liked to change the objDOB = new DateTime(1800, 01, 01); to objDOB = null; but this is not going to work.

Can someone please advise me on what to do?

Regards,
ma se
(South Africa)
AnswerRe: DateTime Pin
J4amieC11-Apr-06 4:35
J4amieC11-Apr-06 4:35 
GeneralRe: DateTime Pin
Brendan Vogt11-Apr-06 4:44
Brendan Vogt11-Apr-06 4:44 
AnswerRe: DateTime Pin
darkelv11-Apr-06 5:17
darkelv11-Apr-06 5:17 
AnswerRe: DateTime Pin
Rob Philpott11-Apr-06 6:45
Rob Philpott11-Apr-06 6:45 
QuestionRe: DateTime Pin
Brendan Vogt11-Apr-06 20:40
Brendan Vogt11-Apr-06 20:40 
AnswerRe: DateTime Pin
Rob Philpott11-Apr-06 20:46
Rob Philpott11-Apr-06 20:46 
QuestionDesign Pattern Pin
sridharmuthupillai11-Apr-06 4:10
sridharmuthupillai11-Apr-06 4:10 
AnswerRe: Design Pattern Pin
Nick Parker11-Apr-06 4:58
protectorNick Parker11-Apr-06 4:58 
QuestionChanging refresh rate Pin
Da_Masca11-Apr-06 4:00
Da_Masca11-Apr-06 4:00 
QuestionGUI as Visual-Studio-IDE Pin
Tomerland11-Apr-06 3:29
Tomerland11-Apr-06 3:29 
AnswerRe: GUI as Visual-Studio-IDE Pin
-Dy11-Apr-06 4:05
-Dy11-Apr-06 4:05 
GeneralRe: GUI as Visual-Studio-IDE Pin
Tomerland11-Apr-06 9:50
Tomerland11-Apr-06 9:50 
AnswerRe: GUI as Visual-Studio-IDE Pin
Luis Alonso Ramos11-Apr-06 7:36
Luis Alonso Ramos11-Apr-06 7:36 
QuestionDispose method Help needed Pin
agmb11-Apr-06 3:20
agmb11-Apr-06 3:20 
AnswerRe: Dispose method Help needed Pin
Guffa11-Apr-06 4:01
Guffa11-Apr-06 4:01 
GeneralRe: Dispose method Help needed Pin
agmb11-Apr-06 6:06
agmb11-Apr-06 6:06 
AnswerRe: Dispose method Help needed Pin
Guffa11-Apr-06 7:11
Guffa11-Apr-06 7:11 

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.