I want to assign today's date to a textbox. In VB.NET it works but in C# it does not.
My code in VB:
Dim strToday as DateTime
strToday = DateTime.Today
txtBox.text = strToday.Date
' Text box txtBox shows today's date, without time as I want it.
C# code:
DateTime strDateTime;
strToday = DateTime.Today;
txtDate.text = strToday.Date; // Error reported by compiler
Then I change the last line to
txtDate.text = strToday.Date.ToString()
// No error here but the textbox shows data and the time.
What am I missing?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham