Object reference not set to an instance of an object.
Here is a portion of the code
public
class UploadDataRS extends System.Web.UI.Page{
protected System.Web.UI.HtmlControls.HtmlInputFile File1; protected System.Web.UI.HtmlControls.HtmlSelect sYear; protected System.Web.UI.WebControls.Label Label3; protected System.Web.UI.WebControls.Label output; protected System.Web.UI.WebControls.Label Label1; protected System.Web.UI.WebControls.Label output2; protected System.Web.UI.HtmlControls.HtmlInputFile File4; protected System.Web.UI.HtmlControls.HtmlInputButton Submit2; protected System.Web.UI.WebControls.TextBox TextBox2; protected System.Web.UI.HtmlControls.HtmlSelect sMonth; private void Page_Load(Object sender, System.EventArgs e){
// Put user code to initialize the page here}
#region
Web Form Designer generated code protected void OnInit(System.EventArgs e){
//// CODEGEN: This call is required by the ASP.NET Web Form Designer. Donot remove this.//
InitializeComponent(); super.OnInit(e);
}
private void InitializeComponent(){
this.TextBox2.add_TextChanged( new System.EventHandler(this.TextBox2_TextChanged) ); this.Submit2.add_ServerClick( new System.EventHandler(this.Submit2_ServerClick) ); this.add_Load( new System.EventHandler(this.Page_Load) ); ........>>>error on this line}
// #endregion
private void Submit2_ServerClick (Object sender, System.EventArgs e){
String strFullName = File4.get_PostedFile().get_FileName();
String strName, strFname="";
int intIndex = strFullName.lastIndexOf("\\");strName = (intIndex != -1) strFullName.substring(intIndex+1) : strFullName;
if (!strName.equals("")){
strFname = "d:\\dev\\PM\\" + strName;
File1.get_PostedFile().SaveAs(strFname);
}
else{
output.set_Text("<div align=center><h3>Error: please select a file for uploading first!</h3></div>");
return;}
Any help is appreciated .. Thanks

VjSharp newbie
gfunsmoot
Just to understand your scenario better.
Are you using Visual Studio 2003 or 2005 Beta1/2
I tried a simple new web application which contains this.add_Load( new System.EventHandler(this.Page_Load) ); , and it works for me.
If you comment out the other two functions, does it still give error
You might want to post this on http://forums.asp.net/ as well.
Thanks,