Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

question

Posted on 1998-12-22
9
Medium Priority
?
293 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 200 total points
ID: 1452095
100/
0
 
LVL 13

Expert Comment

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 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