Object reference not set to an instance of an object

G

Guest

Hi
Any idea what's happening, please?! TIA, details.....

I have a formA.aspx page and a corresponding class file formA.cs compiled
into a library. User is to fill out some information and click a submit
button to trigger a click event. Here is what I have in formA.cs

public Button btnSubmit

protected override void OnInit(EventArgs e)
{
btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
}
void btnSubmit_Click(Object sender, EventArgs e)
{
String domain, str_path, objName;
//code to create obj
if (IsValid) {
...
try
{
DirectoryEntry myDir = new DirectoryEntry(str_path);
...
}
catch (Exception Exception1)
{
System.Runtime.InteropServices.COMException COMEx =
(System.Runtime.InteropServices.COMException)Exception1;
//ConsoleWriteline(COMEx.ErrorCode);
}

//code to add UPN

//code to create LDAP files
}
}
------
Here is the Stack trace
[NullReferenceException: Object reference not set to an instance of an
object.]
NETDS.ouCreate.btnOUCreate_Click(Object sender, EventArgs e) +38
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292


--
 
G

Guest

Sorry, please see my other post ( Subject: ...... - newpost) TIA

The error is in btnOUCreate_Cli­ck event. Need to see that code
 
G

Guest

Sorry, please see my other post ( Subject: ...... - newpost) TIA

The error is in btnOUCreate_Cli­ck event. Need to see that code
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top