Announcement

Collapse
No announcement yet.

How to Convert from VB60 to PB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to Convert from VB60 to PB

    Hi all,

    Some code is not so easy for translate into PB.
    This are the part of code I have it difficult with it

    VB60 source
    Code:
    Private Sub DOEN_Click()
    Dim PauseTime, Start
    Instring$ = ""
        [COLOR="Red"][B]Call WriteReport(Comm.Text)[/B][/COLOR]
    'Debug.Print Mid$(Comm.Text, 3, 1)
    [COLOR="red"][B]If Mid$(Comm.Text, 3, 1) = "L" Or Mid$(Comm.Text, 2, 1) = "L" Or Mid$(Comm.Text, 3, 1) = "l" Or Mid$(Comm.Text, 2, 1) = "l" Then
            Call ReadReport(Instring$, 2)[/B][/COLOR]
            Boodschap.Text = Instring$
    End If
    End Sub
    Try to convert it PB but fails
    Code:
    CALLBACK FUNCTION ShowFRM_PIC_CONTROL_USBProc()      
              SELECT CASE AS LONG CB.MSG 
                   CASE %WM_COMMAND
                         SELECT CASE AS LONG CB.CTL      
                              CASE %IDC_BTN_DOEN
                        IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
                            LOCAL Pauze_Time AS DOUBLE
                            LOCAL Start      AS DOUBLE
                            LOCAL sText      AS STRING
                            LOCAL s1         AS STRING
    
                            g_Instring$ = ""
    
                            [COLOR="red"][B]CONTROL GET TEXT CB.HNDL, %IDC_TXT_COMM, sText
                            WriteReport(sText)
    
                            'WriteReport(Comm.Text)
                            'COMM is a TextBox ID Name such as %IDC_TXT_COMM
                            'Debug.Print Mid$(Comm.Text, 3, 1)
    
                            CONTROL GET TEXT CB.HNDL, %ID_TXT_COMM TO s1
    
                            IF MID$(s1, 3, 1) = "L" OR _
                               MID$(s1, 2, 1) = "L" OR _
                               MID$(s1, 3, 1) = "l" OR _
                               MID$(s1, 2, 1) = "l" THEN
    
                            'If Mid$(Comm.Text, 3, 1) = "L" Or _
                            '   Mid$(Comm.Text, 2, 1) = "L" Or _
                            '   Mid$(Comm.Text, 3, 1) = "l" Or _
                            '   Mid$(Comm.Text, 2, 1) = "l" Then
                            ReadReport(g_Instring, 2)
                            END IF
    [/B][/COLOR]
                            CONTROL SET TEXT CB.HNDL, %IDC_TXT_MESSAGE, g_InString
                            'Boodschap.Text = Instring$
                        END IF   
    
    .............
    1) Visual Basic used always the Statements "CLOSE", "END" is that allowed in PowerBasic to?
    Last edited by Stephane Fonteyne; 24 Dec 2014, 09:26 AM.

    #2
    Our 'eternal converter'..
    Stephane, which part of your code does not work?
    Eddy

    Comment


      #3
      Originally posted by Eddy Van Esch View Post
      Our 'eternal converter'..
      Stephane, which part of your code does not work?
      Eddy,

      The part is BOLD RED I can not translated from VB60 into PB.
      Can you please look at the code in the post
      Direct PIC USB Control
      "http://www.powerbasic.com/support/pbforums/showthread.php?t=58719"

      I have need code of this but I cannot find it here. I want control the PIC with USB with my laptop

      Comment


        #4
        From code shown (it is cut-off), you missing an END IF.

        The compiler does not care about indentation. Indentation makes it easier for the programmer to spot errors. You did that correctly. Now use the indentation in the code in post 1 to see which IF ... THEN is missing the END IF.

        That may not be the only problem, but it is big one.

        Cheers,
        Dale

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎