
December 9th, 2011, 01:27 PM
|
 |
Type Cast Exception
|
|
Join Date: Apr 2004
Location: OAKLAND CA | Adam's Point (Fairyland)
|
|
Both could be replaced by a single line of code. Those procedures look like they were built using the "smack it until it works" approach.
Instead of passing things to a function you're using byref to operate on the variable in the sub. I don't know what platform you're on so a VBA equivalent would be:
Code:
Sub Cut(ByRef a As String)
a = Mid(a, 2, 1)
End Sub
Sub Test()
Dim c As String
c = "abc"
Cut c
Debug.Print c
c = "abc"
Cut (c)
Debug.Print c
End Sub
When you add the parenthesis () you're forcing it to pass by value instead of by reference. Write a function instead of this nonsense.
__________________
medialint.com
“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss
Last edited by medialint : December 9th, 2011 at 01:34 PM.
|