Good afternoon Everyone,
I am having an issue with a legacy application that was more or less dropped on me to support. I originally modified this application to work with a newer system that we use. The problem I am having now is that when the application is run under Windows 7 (opposed to WinXP SP3), it is throwing a runtime 5 error. This error ONLY occurs if the user inputs a string into the specific text box that includes a hyphen. The application is running in WinXPsp3 compat mode with admin rights. The issue can't be replicated on Windows XP and it only occurs with the hypen. When running in debug mode via VB6, the code that appears to be bugging out is:
The flName string is exactly what is being pulled from the textbox they are inputing to. I checked the setfocus, etc, as this was considered a big contributor to a runtime 5 error when dealing with VB6.
I am assuming it has to do with flname spawning as example: OD11-12345, causing the line to bug out, due to the hyphen.
I am extremely rusty with VB6 and lines of this nature. Does anyone have a suggestion to remedy this problem? Below is the full code block that is working towards this error:
I am having an issue with a legacy application that was more or less dropped on me to support. I originally modified this application to work with a newer system that we use. The problem I am having now is that when the application is run under Windows 7 (opposed to WinXP SP3), it is throwing a runtime 5 error. This error ONLY occurs if the user inputs a string into the specific text box that includes a hyphen. The application is running in WinXPsp3 compat mode with admin rights. The issue can't be replicated on Windows XP and it only occurs with the hypen. When running in debug mode via VB6, the code that appears to be bugging out is:
Code:
midFileName = Mid(flName, i + 1, i2 - (i + 1))
I am assuming it has to do with flname spawning as example: OD11-12345, causing the line to bug out, due to the hyphen.
I am extremely rusty with VB6 and lines of this nature. Does anyone have a suggestion to remedy this problem? Below is the full code block that is working towards this error:
Code:
i = InStr(1, flName, "-", vbTextCompare)
i2 = InStr(6, flName, "-", vbTextCompare)
If i Then
leftFileName = Left(flName, 5)
'MsgBox leftFileName
rightFileName = Right(flName, 3)
'MsgBox rightFileName
midFileName = Mid(flName, i + 1, i2 - (i + 1))
'MsgBox midFileName
midFileName = String(6 - Len(midFileName), "0") & midFileName
'MsgBox midFileName
flName = leftFileName & midFileName & rightFileName