V
vishnu
Hi,
I am working on asp.net project which I converted the code fron VB
to C# and instead of RaiseEvent in VB code I used the following code.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using System.IO;
using Toolkit;
public partial class Controls_SelectImage : System.Web.UI.UserControl
{
public delegate void ImageFinalizedEventHandler(object sender,
FileEventArgs e);
public event ImageFinalizedEventHandler ImageFinalized;
protected void Page_Load(object sender, EventArgs e)
{
// Sync the literal in the instructions with the button's text
litFinishButtonText.Text = btnFinish.Text;
}
protected void btnFinish_Click(object sender, EventArgs e)
{
//////RaiseBubbleEvent
try
{
////ImageFinalizedEventHandler eventhandler =
ImageFinalized;
////if (eventhandler != null)
// if (this.ImageFinalized != null)
//ImageFinalized += new ImageFinalizedEventHandler(
OnImageFinalized( new FileEventArgs(this.FileName));
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
//RaiseEvent ImageFinalized(Me, New
FileHandlingEventArgs(FileName));
}
protected void OnImageFinalized(FileEventArgs e)
{
if (ImageFinalized != null)
ImageFinalized(this, e);
}
}
Since ImageFinalized is Null it is not executing ImageFinalized and if
I remove the statement "if (ImageFinalized != null)" It is showing the
error "Object Reference not set......"
More over FileEventArgs is a class,the class code is :
public class FileEventArgs : EventArgs
{
private string _FileName;
//public FileEventArgs()
//{ }
public FileEventArgs(string theFileName):base()
{
_FileName = theFileName;
}
public string FileName
{
get
{
return _FileName;
}
set
{
_FileName = value;
}
}
}
I know that since ImageFinalized method is not yet initialized its
throwing exception.
Can any one help me out to resolve this issue
Regards
Vishnu
I am working on asp.net project which I converted the code fron VB
to C# and instead of RaiseEvent in VB code I used the following code.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using System.IO;
using Toolkit;
public partial class Controls_SelectImage : System.Web.UI.UserControl
{
public delegate void ImageFinalizedEventHandler(object sender,
FileEventArgs e);
public event ImageFinalizedEventHandler ImageFinalized;
protected void Page_Load(object sender, EventArgs e)
{
// Sync the literal in the instructions with the button's text
litFinishButtonText.Text = btnFinish.Text;
}
protected void btnFinish_Click(object sender, EventArgs e)
{
//////RaiseBubbleEvent
try
{
////ImageFinalizedEventHandler eventhandler =
ImageFinalized;
////if (eventhandler != null)
// if (this.ImageFinalized != null)
//ImageFinalized += new ImageFinalizedEventHandler(
OnImageFinalized( new FileEventArgs(this.FileName));
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
//RaiseEvent ImageFinalized(Me, New
FileHandlingEventArgs(FileName));
}
protected void OnImageFinalized(FileEventArgs e)
{
if (ImageFinalized != null)
ImageFinalized(this, e);
}
}
Since ImageFinalized is Null it is not executing ImageFinalized and if
I remove the statement "if (ImageFinalized != null)" It is showing the
error "Object Reference not set......"
More over FileEventArgs is a class,the class code is :
public class FileEventArgs : EventArgs
{
private string _FileName;
//public FileEventArgs()
//{ }
public FileEventArgs(string theFileName):base()
{
_FileName = theFileName;
}
public string FileName
{
get
{
return _FileName;
}
set
{
_FileName = value;
}
}
}
I know that since ImageFinalized method is not yet initialized its
throwing exception.
Can any one help me out to resolve this issue
Regards
Vishnu