-
June 13th, 2013, 11:15 AM
#1
converting VB6 to VB2010
seems that i realy must abandoned the VB6
i have several errors with IDE(i'm using windows 7). and i have VS201 installed.
i have several code for convert, but some code ins't used in VB2010
like vbscript code
but it's there any way for convert the code?
Code:
Public Function ExtendedSplit(ByVal strInputString As String) As String()
Dim i As Integer
Dim objRegExp
Dim objMatch
Dim colMatches
Dim strTestInput As String
Dim strOldValue As String
Dim strNewValue As String
Dim tempArr() As String
' Create a regular expression object.
Set objRegExp = CreateObject("VBScript.RegExp")
'Set the pattern.
objRegExp.Pattern = "\"".*?\"""
'Set global applicability.
objRegExp.Global = True
'Test whether the String can be compared.
If (objRegExp.Test(strInputString) = True) Then
'Get the matches.
Set colMatches = objRegExp.Execute(strInputString)
' Iterate Matches collection.
For Each objMatch In colMatches
strOldValue = objMatch.Value
strNewValue = Replace(strOldValue, Chr(34), Chr(128))
strNewValue = Replace(strNewValue, Chr(32), Chr(129))
'Debug.Print objMatch.Value
strInputString = Replace(strInputString, strOldValue, strNewValue)
Next
End If
For i = 1 To 127
Select Case i
Case 1 To 47, 59 To 64, 91 To 96, 123 To 127
strInputString = Replace(strInputString, Chr(i), " " & Chr(i) & " ")
End Select
Next i
Do While InStr(strInputString, Space(2))
strInputString = Replace(strInputString, Space(2), Space(1))
Loop
strInputString = Trim(strInputString)
tempArr = Split(strInputString, " ")
For i = 0 To UBound(tempArr)
tempArr(i) = Replace(tempArr(i), Chr(128), Chr(34))
tempArr(i) = Replace(tempArr(i), Chr(129), Chr(32))
Next i
ExtendedSplit = tempArr
End Function
and can i convert a ctl file?
-
June 13th, 2013, 01:12 PM
#2
Re: converting VB6 to VB2010
Not possible without re-writing. Doesn't look to complicated. Here's a link to some samples.
-
June 13th, 2013, 01:48 PM
#3
Re: converting VB6 to VB2010
Originally Posted by dglienna
Not possible without re-writing. Doesn't look to complicated. Here's a link to some samples.
that function was someone that help me do it, but i never used VBScript. so how can i convert that part to VB2010?
i'm doing these because my VB6 is damage and i don't know to fix it
any time of runtime error, can crash VB6 and the Windows 7 close it
(i have VS2010 installed too... and i use compatible options for open VB6)
-
June 14th, 2013, 02:15 AM
#4
Re: converting VB6 to VB2010
Perhaps if you could give a proper explanation of what the code is supposed to do, we could help better
-
June 14th, 2013, 03:31 AM
#5
Re: converting VB6 to VB2010
Originally Posted by HanneSThEGreaT
Perhaps if you could give a proper explanation of what the code is supposed to do, we could help better
see these samples:
(the symbols are separed too)
int soma(int a, int b)
words(0)="int"
words(1)="soma"
words(2)="("
words(3)="int"
words(4)="a"
words(5)=","
words(6)="int"
words(7)="b"
words(8)="("
another sample:
write("hello world")
words(0)="write"
words(1)="("
words(2)=""hello world""
words(3)=")"
like you see that function separe the line text to a string array.
maybe i can do that with Split() and mid(), but is more complicated for the string
Last edited by Cambalinho; June 14th, 2013 at 03:34 AM.
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
|