Hi All! I have created a MDI CNC G code editor in VB6. It has many G code manipulation tools as well as graphical tool path and run time representation. I am using RichTextBox for the G code editing. This app has been working well for many years in Windows XP but has issues in Windows 7 and up, specifically with G code manipulation in the RichTextBox. General loading, editing and saving the contents of the RTB seams to work ok but when I load the RTB contents into a String variable, there seams to be issues with InStr() and Mid() misinterpretation. I was wondering if anyone else has seen this issue and if there is a fix or maybe a different approach. See example and thanks for any help!
Code:
myString = frmMain.ActiveForm.rtb.Text
For i = 1 to Len(myString)
If Mid(myString, i, 1) = "A" Then
For j = i + 1 To InStr(i, myString, vbCrLf)
If Mid(myString, j, 1) > Chr(57) Or _
Mid(myString, j, 1) < Chr(45) Then
newString = Mid(myString, i, j - i)
i = j
Exit For
End If
Next j
End If
Next i