|
-
Aug 30th, 2000, 09:24 AM
#1
Thread Starter
Member
Here is a question I recently answered on a practice Transcender test.
Which Statement below actually causes the object to be created?
1) Dim MyObject as New MyClass
2) MyObject.Name = "MyObject"
3) Set MyObject = CreateObject(MyClass)
Well, I picked #1 but the correct answer is #2.
So I check in my text book and find the following statement:
"When you create an instance of a control, such as a text box, and set the name property to txtThing, Visual Basic responds as if the following statement had just exectuted:"
Dim txtThing as New TextBox
Well, I've placed TextBoxes on my form WITHOUT changing the name property and I've used them so I KNOW they've been "created".
Obviously there is a little "trick" here. Does the NEW statement just set aside space for a reference to an object that isn't created until you use it in code or what? Why is this question even important? There must be some key I'm missing here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|