Object reference not set to an instance of an object

Discussion in 'ASP .Net' started by Guest, May 10, 2005.

  1. Guest

    Guest 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


    --
    Guest, May 10, 2005
    #1
    1. Advertising

  2. Guest

    BillGatesFan Guest

    The error is in btnOUCreate_Cli­ck event. Need to see that code
    BillGatesFan, May 10, 2005
    #2
    1. Advertising

  3. Guest

    Guest Guest

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

    "BillGatesFan" <> wrote in message
    news:...
    The error is in btnOUCreate_Cli­ck event. Need to see that code
    Guest, May 10, 2005
    #3
  4. Guest

    Guest Guest

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

    "BillGatesFan" <> wrote in message
    news:...
    The error is in btnOUCreate_Cli­ck event. Need to see that code
    Guest, May 10, 2005
    #4
  5. What are u trying to do exactly?


    "dl" wrote:

    > 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
    >
    >
    > --
    >
    >
    >
    >
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, May 10, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Parthiv Joshi
    Replies:
    2
    Views:
    674
    Kalyan
    Jul 2, 2004
  2. Suresh Kojhani
    Replies:
    1
    Views:
    2,364
    Anushi
    Jul 29, 2004
  3. Chris Fink
    Replies:
    2
    Views:
    4,066
    David Waz...
    Jul 3, 2003
  4. yysiow
    Replies:
    1
    Views:
    423
    Kevin Spencer
    Jul 12, 2003
  5. Replies:
    1
    Views:
    468
    Mark Rae [MVP]
    Sep 20, 2007
Loading...

Share This Page