Link to home
Start Free TrialLog in
Avatar of tmccrank
tmccrank

asked on

Object reference not set to an instance of an Object...

If I had a nickel for everytime I got this error.... this one has had this noob guessing for a while though.

Here's my code in the Page_Load sub:

        ' the PopulateDropDown() method returns an ArrrayList from my DAL.
        Dim alDD As ArrayList = DA.PopulateDropDown()

        'populate Modules drop down list
        ddlModules.DataSource = alDD
        ddlModules.DataBind()

It stops on the first line, but I'm stuck on what it means!

Thanks for any help!
Avatar of Andrew Beers
Andrew Beers
Flag of United States of America image

DA.PopulateDropDown()

Requires that you have defined DA

If you have not defined DA then this will not work because DA is being treated as an object refrence it is declaring that it is not set to any known instance of an object.  

Let me know if this helps.

~Aqua
Avatar of tmccrank
tmccrank

ASKER

Thanks Aqua,

I defined DA at the form level (if that's the right term) since I wanted it to be in scope for all the methods in the Class.

That is, just below the Web Form Designer Generated Code block, I did this:

Dim DA As DAL NurseEdMods.DataAccess

Is that what you meant by defining DA?

Jens
ASKER CERTIFIED SOLUTION
Avatar of Andrew Beers
Andrew Beers
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
...Sorry, DAL NurseEdMods.DataAccess should read DAL_NurseEdMods.DataAccess.
Aqua,
Thanks... I just realized that there's a seperate VB.NET forum which I should have posted to.  I'll try it there and see what happens.
Posting the rest of my code probably wouldn't help much (it seems to me, which isn't saying much) since the error is popping up right at the first line of code.  I set a breakpoint on it which should at least fire me to the PopulateDropDown() method in my Data Access Layer, but that's not happening.  Hm.  Anyway, I'll try it over in VB.NET.  Hopefully I can award you the points for the time you took to answer.
Thanks again,
J