Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
GeneralRe: File download in Class Library Pin
Richard MacCutchan11-Mar-13 22:56
mveRichard MacCutchan11-Mar-13 22:56 
QuestionSimple helper class for DateTime? Pin
Goaty6510911-Mar-13 12:59
Goaty6510911-Mar-13 12:59 
AnswerRe: Simple helper class for DateTime? Pin
Garth J Lancaster11-Mar-13 13:13
professionalGarth J Lancaster11-Mar-13 13:13 
AnswerRe: Simple helper class for DateTime? Pin
Dave Kreskowiak11-Mar-13 13:22
mveDave Kreskowiak11-Mar-13 13:22 
GeneralRe: Simple helper class for DateTime? Pin
Goaty6510911-Mar-13 13:41
Goaty6510911-Mar-13 13:41 
AnswerRe: Simple helper class for DateTime? Pin
DaveyM6911-Mar-13 13:41
professionalDaveyM6911-Mar-13 13:41 
GeneralRe: Simple helper class for DateTime? Pin
Goaty6510911-Mar-13 13:50
Goaty6510911-Mar-13 13:50 
GeneralRe: Simple helper class for DateTime? Pin
DaveyM6911-Mar-13 13:52
professionalDaveyM6911-Mar-13 13:52 
No problem!

By using a property as in the code I posted, or using DateTime.Now each time directly rather than a cached field as you were attempting previously.

Edit: If you want to make it a little less wordy to access you could just create a static property or method that does it all for you:
C#
public static class DateTimeHelpers
{
    private const string MonthDayFormat = "MM/dd";

    public static string NowMonthDayString
    {
        get { return DateTime.Now.ToString(MonthDayFormat); }
    }
}

C#
textBox1.Text = DateTimeHelpers.NowMonthDayString;

Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



GeneralRe: Simple helper class for DateTime? Pin
Goaty6510911-Mar-13 13:59
Goaty6510911-Mar-13 13:59 
GeneralRe: Simple helper class for DateTime? Pin
DaveyM6911-Mar-13 14:04
professionalDaveyM6911-Mar-13 14:04 
AnswerRe: Simple helper class for DateTime? Pin
V.11-Mar-13 23:11
professionalV.11-Mar-13 23:11 
QuestionWCF Method that takes an object as its parameter Pin
David Chen11-Mar-13 11:47
David Chen11-Mar-13 11:47 
Questionupdating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 10:12
Eng.almasrouhi11-Mar-13 10:12 
AnswerRe: updating MS database using c#.net Pin
jschell11-Mar-13 10:57
jschell11-Mar-13 10:57 
GeneralRe: updating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 11:26
Eng.almasrouhi11-Mar-13 11:26 
GeneralRe: updating MS database using c#.net Pin
NotPolitcallyCorrect11-Mar-13 11:45
NotPolitcallyCorrect11-Mar-13 11:45 
GeneralRe: updating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 12:09
Eng.almasrouhi11-Mar-13 12:09 
GeneralRe: updating MS database using c#.net Pin
NotPolitcallyCorrect11-Mar-13 14:07
NotPolitcallyCorrect11-Mar-13 14:07 
JokeRe: updating MS database using c#.net Pin
Eddy Vluggen11-Mar-13 11:48
professionalEddy Vluggen11-Mar-13 11:48 
GeneralRe: updating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 12:13
Eng.almasrouhi11-Mar-13 12:13 
AnswerRe: updating MS database using c#.net Pin
jschell12-Mar-13 9:21
jschell12-Mar-13 9:21 
Questionerror with update query Pin
User349011-Mar-13 9:23
User349011-Mar-13 9:23 
AnswerRe: error with update query Pin
vanikanc11-Mar-13 9:31
vanikanc11-Mar-13 9:31 
GeneralRe: error with update query Pin
User349011-Mar-13 9:36
User349011-Mar-13 9:36 
GeneralRe: error with update query Pin
vanikanc11-Mar-13 10:13
vanikanc11-Mar-13 10:13 

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.