|
-
Apr 11th, 2005, 09:52 AM
#1
Thread Starter
Addicted Member
A bug in VB?... or something else?
I've got a problem with my project. The application is about 5 years old and has been in constant development throughout that time. Today though, I've started getting a weird error. Error 16, expression too complex.
The line it breaks on is:
Code:
ScrollIncrement = 1
ScrollIncrement is a long integer variable which is private to the sub.
According to MSDN, this shouldn't happen. Has anyone else come across this problem before?
-
Apr 11th, 2005, 09:54 AM
#2
Re: A bug in VB?... or something else?
Nope.
Try changing the value and see what happens.
Is the scrollbar enabled? Visible? Are the limits more than the incriment value apart from each other?
-
Apr 11th, 2005, 09:58 AM
#3
Thread Starter
Addicted Member
Re: A bug in VB?... or something else?
ScrollIncrement isn't a scrollbar. It's a variable.
The code hasn't changed in that sub at all.
The only code I added is this:
VB Code:
ReDim ExpandedInvoices(0)
If MemoriseExpanded = True Then
If (Not MasterList) <> -1 Then
For i = 0 To UBound(MasterList) - 1
If MasterList(i).Expanded = True Then
If MasterList(i).Type = InvoiceHeader Then
ExpandedInvoices(UBound(ExpandedInvoices)) = MasterList(i).InvoiceNumber
ReDim Preserve ExpandedInvoices(UBound(ExpandedInvoices) + 1)
End If
End If
Next
End If
End If
This is in a different sub which is called before the one with the error. If I comment out this section of code the error goes away...
...but if I step through that code (using f8) the error doesn't occur then either.
-
Apr 11th, 2005, 10:04 AM
#4
Re: A bug in VB?... or something else?
This line looks suspect to me. What data type is MasterList, and what are you trying to achieve with this code?
VB Code:
If (Not MasterList) <> -1 Then
This world is not my home. I'm just passing through.
-
Apr 11th, 2005, 10:08 AM
#5
Thread Starter
Addicted Member
Re: A bug in VB?... or something else?
MasterList is a dynamic array of a UDT. That line just checks it to see if it's been dimensioned or not.
-
Apr 11th, 2005, 11:29 AM
#6
Re: A bug in VB?... or something else?
Can you show the code that contains the ScrollIncrement = 1 line?
-
Apr 11th, 2005, 11:44 AM
#7
Fanatic Member
Re: A bug in VB?... or something else?
Do you have Option Explicit everywhere ?
What happens if you use -
Run Start with full compile,
instead of
Run Start
-
Apr 11th, 2005, 12:46 PM
#8
Re: A bug in VB?... or something else?
I had the same problem before, and the problem is with this line:
VB Code:
If (Not MasterList) <> -1 Then
Find another way to get if the array is redimmed or not...
Try something like this:
VB Code:
On Error Resume Next
dummyval = MasterList(LBound(MasterList))
If Err.Number = 0 Then
' dimmed
Else
' array empty (erased)
End If
-
Apr 11th, 2005, 03:53 PM
#9
Re: A bug in VB?... or something else?
I agreee with others: line If (Not MasterList) <> -1 Then is the beast ...
Check LBound or UBound to see if arrary is dimmed and trap error ...
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
|