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

Thread: gwbasic to VB

  1. #1
    Join Date
    Oct 2001
    Location
    East Coast
    Posts
    2

    gwbasic to VB

    I am very new to VB and now have a project I am working on that has me scratching my head. This is some code I have from gwBasic and it works but I want to put it in VB to make a gui interface. The following code runs circuts that open and close in a switch. I want to know if someone can help me put this into VB.


    10 OPEN "COM1:19200,N,B,1,DS,CS" as #1
    20 CLSrint"PRESS KEY"
    30 for X=32 to 62 step 2
    40 print #1,CHR$(X);
    50 next X
    60 for X=33 to 63 step 2
    70 K$=INKEY$:IF K$="" THE 70
    80 print"RELAY";(X+1)/2
    90 print #1,CHR$(X);
    100 next X
    110 GOTO 20





  2. #2
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: gwbasic to VB

    Here is my attempt. I have never used the mscomm control nor any com port programming with basic.

    project with 1 command button, 1 textbox with multiline set to true, mscomm control.


    Option Explicit
    Dim x As Integer

    Private Sub Command1_Click()
    Text1 = ""
    For x = 33 To 63 Step 2
    Text1 = Text1 & "RELAY " & (x + 1) / 2 & vbCrLf
    MSComm1.Output = Chr$(x)
    Next x


    End Sub

    Private Sub Form_Load()
    Command1.Caption = "Press Key"
    Text1 = ""
    MSComm1.CommPort = 1
    MSComm1.Settings = "19200,n,8,1"
    MSComm1.PortOpen = True
    For x = 32 To 62 Step 2
    MSComm1.Output = Chr$(x)
    Next x

    End Sub




    David Paulson


  3. #3
    Join Date
    Oct 2001
    Location
    East Coast
    Posts
    2

    Re: gwbasic to VB

    I appreciate your attempt, i will apply it and let you know the outcome.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured