answersLogoWhite

0


Best Answer

in vb.net dim xyz as myclass=new class or dim xyz as new myclass you might have missed the new key word

AnswerThink of all data as an "object". An object can be something simple, like an integer, or can be something cmoplex (what we call an "aggregate"... a mixture of things, like the way comcrete is an aggregegate mixture of stuff)... such as a "Customer", with a name, ID Number, and account balance. An object is stored in memory, and is referred to or "Referenced" by a variable. Dependign on the language you are writing in, this relationship between the variable and the object (what we call an "instance" of an object.) may be very clear, or it may be somewhat ambiguous. Think of a an object variable like an index card that holds an address. If I hand you a blank index card, you indeed have something on which you can record an address, but you have no address-- The index card is an object reference, but at this moment it doesn't refer to anything.

Some variables, like an integer for example (simple built-in types in most languages) are usually automatically initialized to point to an instance of an object of the appropriate type. Some languages will then even initialize that object with a default value (like 0 for an integer in Basic). However, complex object types (the classes you define) are not automatically initialized to instances of an object. In Visual Basic, you insantiate an objec tiwht the SET keyword and use NEW to create a new instance:

Dim x as MyClass set x = new MyClass

In C#, You simply assign the object variable an instance of the class:

MyClass x; x = new MyClass();

You are receiving the "Object Reference Not Set to an Instance of an Object" because at some point in your program, you are trying to use or manipulate the data stored in an object variable, but the object isn't pointing to anything. This would be like getting in your car with the blank index card I gave you and trying to drive to an address that doesn't exist. :)

Jim

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What do you do when a box comes up that says object reference not set to an instance of object?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is object oriented para diagram?

There are two types of languages. Procedure oriented language and object oriented langugae. An object oriented langugae is quite impresses from real world environment. it says that for example a classroom is full with chairs then that class is a class of object oriented and those chairs are object... Basically this makes programing very easy and short... Hope this answer was of some help...


How are currents calculated?

Ohm's Law says I = V/R. You need to know the voltage across the component and its resistance, for that particular temperature and time, in order to calculate the current in the component at that instance.


Static keyword in java?

A Static method in Java is one that belongs to a class rather than an object of a class. Normal methods of a class can be invoked only by using an object of the class but a Static method can be invoked Directly. Example: public class A { ..... public static int getAge(){ .... } } public class B { ..... int age = A.getAge(); } In class B when we wanted the age value we directly called the method using the instance of the class instead of instantiating an object of the class. Tip: A static method can access only static variables. The reason is obvious. Something that is common to a class cannot refer to things that are specific to an object...


An interface can have private instance attributes?

No.The private modifier says that no other class can see that attribute. Since interfaces cannot contain any implemented methods (no functional code), there would be no reason to allow for private members of an interface.


What are the features of OOP?

The primary features of an object oriented language are: * Encapsulation - This allows every object to have its own properties and behaviors separate from others, and its own little "capsule" to keep its properties in. * Inheritance - This allows an object to inherit the properties of its ancestors. * Polymorphism - The allows an object to be treated like one of its ancestors, i.e. if Truck was a subclass or descendant of an object called Automobile, it can redo behaviors that Automobile had, like Automobile has a suspension feature that has it set to 10 inches tall, Truck overwrites it and says its 30 inches tall. * Abstraction - This idea is related to encapsulation in that you don't care how the object works, but you can make it behave in certain manners.

Related questions

Unbalanced forces acting on an object produce motion?

The second law of Newton says that the sum of all the forces acting on an object is equal to the acceleration of this object, in a given frame of reference. If the sum of forces isn't equal to zero, therefore the acceleration isn't to. So the object has a speed and is in motion, in the frame of reference chosen.


How many times does the kings james version Bible say come?

Many times: One reference says 500 times and another reference says 2200 times


Here comes the human who says that in twilight?

Rosalie says "here comes the human" in the first movie/book.


Who says in reference to Abigail She must be ripped out of the world?

Elizabeth Proctor


Should you capitalize government if it says teaches government?

No it shouldn't be capitalized in this instance.


What is that stuff called that comes in a bottle and says deep burn on the front?

Alcohol is that stuff that comes in a bottle and says deep burn on the front.


How does Archimede's principle relate to the buoyant force acting on an object to the fluid displaced by the object?

It says that the buoyant force acting on the object is equalto the weight of the fluid displaced by the object.


What does it mean when a job application says Other reference with this employer?

it means when you fly, you fall


What does your boyfriend mean when he says he wants to skeet on you?

It is a colloquial (slang) reference to his desire to ejaculate on you.


Who says in reference to Abigail the girl is murder! she must be ripped out of the world?

Elizabeth Proctor


Who says in reference to Abigail The girl is murder She must be ripped out of the world?

Elizabeth Proctor


Is a tree an object?

yes because you can draw it. my mom says that if you can draw it it is an object. An 'OBJECT' is defined as anything that is visible or tangible and stable in form so yes a tree is an object.