hi im a newbie in C# i just have a question where do i put in the code this one

samplePX = new exPX(this);

because im trying to do a sample program that i am reading and practicing right now and it says
"Create an object in your task class constructor. Use the code: samplePX = new exPX(this);"

where do i put samplePX = new exPX(this); in the following code? thanks.

using System;
using System.Configuration;
using System.Globalization;



namespace Sample
{
/// <summary>
/// Summary description for RunEx.
/// </summary>
public class RunEx : TaskBase
{
/// <summary>
/// Required designer variable.
/// </summary>
private DataLink dataLink1;


private string HTML_PATH;


#region TaskBase overloads


/// <summary>
/// InitializeTask: initializes the task.
/// </summary>
protected override void InitializeTask()
{
HTML_PATH = ConfigurationManager.AppSettings["HTML Path"];



#region Create Used Objects


dataLink1 = new DataLink();


#endregion


#region Event Hookup



#endregion
}


/// <summary>
/// Start: this method is called to inform the task that it should activate.
/// </summary>
public override void Start(int action)
{
Log.LogInfo( "Start {0}", action );


// TODO: implement your tasks logic here


// When your task is finished, call
//      base.SetResult( int result ) or
//      base.SetResult( string result )
//
// Always make sure that the result you set is declared in AssemblyInfo.cs
}


/// <summary>
/// Quit: this method is executed before the task is unloaded.
/// </summary>
public override void Quit( QuitReason reason )
{
Dispose( );
}


#endregion



/// <summary>
/// Clean up any resources being used.
/// </summary>
#region Dispose


protected override void Dispose( bool disposing )
{
try
{
if ( ! Disposed )
{
if ( disposing )
{
// Here (and only here) I should dispose managed resources
Browser.Dispose();


}
// Here I should dispose unmanaged resources (but not managed resources!)


}
}
finally
{
// And call the base class
base.Dispose( disposing );
}
}


#endregion


#region Event Handlers



#endregion


}
}

Edited 3 Years Ago by happygeek: fixed formatting

I'm not really sure I understand exactly what you're asking. Theres obviously some enums or other classes that we're not being provided here. If I just compiled this code as-is, there would be a bunch of undefined references.

This article has been dead for over six months. Start a new discussion instead.