|
-
Feb 14th, 2011, 07:49 PM
#1
Thread Starter
Junior Member
[RESOLVED] Implementing a Inc() function in VB6
Hi Guys...
I am an old Delphi programmer and have taken over a VB6 (sp6) project that has millions of lines of code...
I am trying to make some functions and processes in the code more efficient by rewriting some of the functions.
There are a lot of i= i+1 type lines in the code that are driving me crazy so I am trying to implement a inc() function that works as it does in Delphi...
I have this sub;
Public Sub Incr(ByRef VValue As Long, Optional Increment As Long = 1)
' Returns vValue increased by 'Increment' value
VValue = VValue + Increment
End Sub
I have tried passing the value both ByRef and ByVal.
If I use a standalone variable (e.g. lCounter) and pass it to this sub, it returns with the number incremented. I use it in this fashion;
Do while something
incr (lcounter)
Loop
If I pass it a value from a control, e.g. progbar1.value, it does not increment the value... it comes back = 0 (zero) every time.
Do while something
incr (progbar1.value)
Loop
Can someone give me some insight as to why it wont increment my progress bar value?
Thanks for the assist.
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
|