Click here to Skip to main content
15,892,737 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
OriginalGriff14-Jul-19 23:35
mveOriginalGriff14-Jul-19 23:35 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
wrightyrx714-Jul-19 23:50
wrightyrx714-Jul-19 23:50 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
OriginalGriff15-Jul-19 0:17
mveOriginalGriff15-Jul-19 0:17 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
wrightyrx715-Jul-19 0:33
wrightyrx715-Jul-19 0:33 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
OriginalGriff15-Jul-19 0:47
mveOriginalGriff15-Jul-19 0:47 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
wrightyrx715-Jul-19 3:08
wrightyrx715-Jul-19 3:08 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
OriginalGriff15-Jul-19 3:46
mveOriginalGriff15-Jul-19 3:46 
AnswerRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
phil.o14-Jul-19 23:52
professionalphil.o14-Jul-19 23:52 
I usually do it this way:
C#
private void TestingButton_Click(object sender, EventArgs e)
{
    using (Form_EffectiveDate form = new Form_EffectiveDate())
    {           
        if (form.ShowDialog(this) == DialogResult.OK)
        {
            EffDateTextBox.Text = form.EffectiveDate;
        }
    }
}

In Form_EffectiveDate, set the OKButton property of the form to DateOKButton (this negates the need to write an event-handler for the button). Then:
C#
public partial class Form_EffectiveDate : Form
{
    public DateTime EffectiveDate
    {
        get { return effDateTimePicker.Value; }
    }

    public Form_EffectiveDate()
    {
        InitializeComponent();
    }
}

C#
enum HumanBool { Yes, No, Maybe, Perhaps, Probably, ProbablyNot, MostLikely, MostUnlikely, HellYes, HellNo, Wtf }

GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
wrightyrx715-Jul-19 0:34
wrightyrx715-Jul-19 0:34 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
phil.o15-Jul-19 0:43
professionalphil.o15-Jul-19 0:43 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
wrightyrx715-Jul-19 1:00
wrightyrx715-Jul-19 1:00 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
OriginalGriff15-Jul-19 1:30
mveOriginalGriff15-Jul-19 1:30 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
wrightyrx715-Jul-19 1:35
wrightyrx715-Jul-19 1:35 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
OriginalGriff15-Jul-19 1:47
mveOriginalGriff15-Jul-19 1:47 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
phil.o15-Jul-19 1:46
professionalphil.o15-Jul-19 1:46 
AnswerRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
Sagar-Jaybhay16-Jul-19 4:19
Sagar-Jaybhay16-Jul-19 4:19 
QuestionPowerpoint addin - where to start? Pin
pr1mem0ver12-Jul-19 5:04
pr1mem0ver12-Jul-19 5:04 
AnswerRe: Powerpoint addin - where to start? Pin
OriginalGriff12-Jul-19 5:25
mveOriginalGriff12-Jul-19 5:25 
GeneralRe: Powerpoint addin - where to start? Pin
pr1mem0ver15-Jul-19 14:53
pr1mem0ver15-Jul-19 14:53 
QuestionPredicateBuilder Question Pin
Kevin Marois10-Jul-19 7:32
professionalKevin Marois10-Jul-19 7:32 
AnswerRe: PredicateBuilder Question Pin
Luc Pattyn10-Jul-19 7:41
sitebuilderLuc Pattyn10-Jul-19 7:41 
GeneralRe: PredicateBuilder Question Pin
Kevin Marois10-Jul-19 7:52
professionalKevin Marois10-Jul-19 7:52 
GeneralRe: PredicateBuilder Question Pin
Luc Pattyn10-Jul-19 7:55
sitebuilderLuc Pattyn10-Jul-19 7:55 
QuestionAvoid ASP Page Refresh after button click Pin
ahmadroheed9-Jul-19 18:04
ahmadroheed9-Jul-19 18:04 
AnswerRe: Avoid ASP Page Refresh after button click Pin
Gerry Schmitz10-Jul-19 6:22
mveGerry Schmitz10-Jul-19 6:22 

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.