Click here to Skip to main content
15,908,013 members
Home / Discussions / C#
   

C#

 
QuestionFile download in Class Library Pin
Member 961703711-Mar-13 18:18
Member 961703711-Mar-13 18:18 
AnswerRe: File download in Class Library Pin
Dave Kreskowiak11-Mar-13 19:05
mveDave Kreskowiak11-Mar-13 19:05 
GeneralRe: File download in Class Library Pin
Member 961703711-Mar-13 19:35
Member 961703711-Mar-13 19:35 
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 
LOL

I understand the concerns. What I have is a huge list of if statements associated with one of my buttons. They all will return this date in some way. Instead of having a million copies of the same code, I want to reference that class so when I change something within that class, it applies to all instances of the code.

The error I am getting is An object reference is require for non-static field, method, or property.

Copying the code

C#
DateTime time = DateTime.Now;
string formatDate = "MM/dd";

textBox1.Text = time.ToString(formatDate);


In each and every if statement seems like it would be a big waste of code and space. I have about 20 buttons or so that would use it, each with 2 if statements attached. I want to just reference that code in a helper class and just have to type something like this:

C#
textBox1.Text = Parameters.time.ToString(Parameters.formatDate);


which would return "03/11" in the text box, for today's date.

I hope this helps clarify my intentions, thanks.
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 
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 

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.