dcsimg
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Type Declarations

Question:
I define a user-defined type as follow..
Type Complex
   Re As Double
   Im As Double
End Type
I created a function like this...
Function CompAdd( a As Complex, b As Complex ) As Complex
   CompAdd.Re = a.Re + b.Re
   CompAdd.Im = a.Im + b.Im
End Function
I'm now using the Visual Basic 4.0. When I use this function by following by the following statement...
Dim c,d,e As Complex
e = CompAdd( c, d )
the complier always say that variable 'c' is 'ByRef argument type mismatch'. Do you have any suggestion to my problem? Thank you for your kind attention.

Answer:
You're probably getting the error because the Dim x, y, z as Complex probably isn't working right. Try doing it as individual lines:

Dim c as Complex
Dim d as Complex
Dim e as Complex
That should take care of the problem. Basically, you are telling it to dim c and d as integers, and e as complex. It's a little strange, but I've seen this problem too.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date