converting VB6 to VB2010
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: converting VB6 to VB2010

  1. #1
    Join Date
    Apr 2009
    Posts
    596

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,873

    Re: converting VB6 to VB2010

    Not possible without re-writing. Doesn't look to complicated. Here's a link to some samples.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2009
    Posts
    596

    Re: converting VB6 to VB2010

    Quote Originally Posted by dglienna View Post
    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)

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,074

    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

  5. #5
    Join Date
    Apr 2009
    Posts
    596

    Re: converting VB6 to VB2010

    Quote Originally Posted by HanneSThEGreaT View Post
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center