Solved

question

Posted on 1998-12-22
9
276 Views
Last Modified: 2010-05-03
Suppose you have reference to muclass
could folloving code run and if then what  
Msgbox will display
Sub MySub(argObject as MyClass)

On Error Resume Next
Dim MyObject as New MyClass
Err.Clear
Set MyObject = argObject
argObject.Value = 100
Set argObject = Nothing
MsgBox MyObject.Value & "/" & Err.Description
End Sub

0
Comment
Question by:mativare
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
9 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452088
No, code is not correct.
- err.clear will clear the description
- new is useless
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452089
Your code is the same as this
Sub MySub(argObject as MyClass)
  argObject.Value = 100
End Sub

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452090
You probably meant this

Sub MySub(argObject as MyClass)
  On Error goto leave
  Set argObject  = new MyClass
  argObject.Value = 100
  exit sub
leave:
  MsgBox Err.Description
End Sub

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:mativare
ID: 1452091
No
Try to use only my code
I got it from so-called VB WWW tests.
Try to give a answer what messagebox will display
you are probably right that code is not right
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452092
It will display the old value of the argobject \

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452093
100\
0
 
LVL 1

Author Comment

by:mativare
ID: 1452094
Are you sure
Notice
Set MyObject = argObject
argObject.Value = 100
so argobject gets value after
are you sure
Set MyObject = argObject sets value of Myobject too automatically
it is confusing to me
can answer be     0\      ????

0
 
LVL 1

Accepted Solution

by:
mathies earned 50 total points
ID: 1452095
100/
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1452096
Tell me what you want to know
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question