Expresion too complex error in VB6

Posted on 2008-10-17
Last Modified: 2013-11-26
Hi all,

I have an aplication written in VB6 that in which I'm testing a linear equations solver implemented in a standard DLL in C. If I run the code not using the DLL (using the traditional solver in VB) the code runs well, but if I use the DLL, the software returns an "Expression too complex" error, interestingly enough, on another completely different part of the code. The C DLL is a straight translation from the original code, and, to add a little fun, this happens on one PC but nor in another, both using exactly the same version of VB (down to the service pack), Windows, and solver DLL. Have anybody seen anything like this?

Best regards

Question by:interfaces
  • 4
  • 2

Expert Comment

ID: 22740993
Is the OS same on both machines?

What about regional settings?

You'd be surprised.
LVL 55

Expert Comment

by:Jaime Olivares
ID: 22741003
>> but if I use the DLL, the software returns an "Expression too complex" error
is this a runtime error? or at compile time when you try to build the DLL?

Author Comment

ID: 22743340
Hi Jaime,

It's a runtime error.


How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline


Author Comment

ID: 22743352
Hello mirzas,

Regional settings, and OS versions are the same.



Expert Comment

ID: 22755889
Here is a quote from the VB reference:

Visual Basic Reference: Error Messages
Expression too complex

A floating-point expression contains too many nested subexpressions.
To correct this error

    * Break the expression into as many separate expressions as necessary to prevent the error from occurring.

Now as for the different behavior on different machines.. there MUST be something that IS different between them.
Since you're using VB I do not see how hardware differences could cause this problem.
So it must be the software.

Author Comment

ID: 22759741
I was finally able to narrow the problem a bit. It seems that the calculation code (VB) is consuming too many resources. If I let the program run without doing anything else, It carries on ok, but If I try to do something else, the "Expression too complex" error occurs. On one PC the error happens under these circumstances, but on the other it happens every time. I guess I'll have to re-write all the equations in a more step-by-step mode, and see If i can get rid of the error.

Accepted Solution

interfaces earned 0 total points
ID: 22797995
Well, I found the problem

The function in the DLL was declared as returning a float value, but in the VB6 Client app, it was declared as a Sub. Changing the declaration in the DLL to void solved the problem.

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now