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. Advertisements

  2. Guest

    BillGatesFan Guest

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

  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. Advertisements

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:
    928
    Kalyan
    Jul 2, 2004
  2. Suresh Kojhani
    Replies:
    1
    Views:
    2,672
    Anushi
    Jul 29, 2004
  3. Chris Fink
    Replies:
    2
    Views:
    4,319
    David Waz...
    Jul 3, 2003
  4. yysiow
    Replies:
    1
    Views:
    582
    Kevin Spencer
    Jul 12, 2003
  5. Tim
    Replies:
    1
    Views:
    615
    Bill Priess
    Jul 17, 2003
  6. Pedro Correia
    Replies:
    0
    Views:
    744
    Pedro Correia
    Jul 25, 2003
  7. Mike John
    Replies:
    1
    Views:
    627
    Jenny
    Jul 28, 2003
  8. Replies:
    1
    Views:
    720
    Mark Rae [MVP]
    Sep 20, 2007
Loading...