Results 1 to 7 of 7

Thread: I need code in vb 6.0 it is in qb

  1. #1

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Angry I need code in vb 6.0 it is in qb

    The following QuickBASIC code will read the employee names and display them on the screen.
    Remember to open the .POS file as SHARED in the GLOBAL folder if the Cash Register program is being used over a network.
    Code:
    COLOR 15, 1: CLS
    DIM EMP$(56)
    FL$ = "KEYSHOP"
    OPEN FL$ + ".POS" FOR RANDOM AS 1 LEN = 80
    FOR E = 0 TO 1
       FOR A = 1 TO 3: FIELD 1, (A - 1) * 24 AS NULL$, 24 AS E$(A): NEXT
       FOR A = 0 TO 9
          GET 1, A + 11 + E * 291
          FOR B = 1 TO 3
             C = A * 3 + B: IF C < 29 THEN EMP$(C + E * 28) = E$(B)
    NEXT B, A, E
    FOR A = 1 TO 19
       FOR B = 0 TO 2
          C = A + B * 19
          IF C < 57 THEN
             LOCATE A, B * 26 + 1
             PRINT USING "##.\                     \"; C; EMP$(C);
          END IF
    NEXT B, A
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: I need code in vb 6.0 it is in qb

    This had no responses and had dropped way down on page 2 of ClassicVb so I'm moving it here in the hopes that someone will know enough about QuickBasic to lend a hand.

  3. #3
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: I need code in vb 6.0 it is in qb

    can you post the keyshop.pos file please?
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  4. #4

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Angry Re: I need code in vb 6.0 it is in qb

    no I can post bob.pos
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  5. #5

    Re: I need code in vb 6.0 it is in qb

    yeah, post some sort of example of the file to be opened, and explain what the program should do with employee names. im sure someone can help you quite quickly.

  6. #6
    New Member
    Join Date
    Jul 2006
    Location
    Manila. Philippines
    Posts
    12

    Re: I need code in vb 6.0 it is in qb

    Ok i am putting line numbers in your code for our easy reference.

    Code:
    01      COLOR 15, 1: CLS
    02      DIM EMP$(56)
    03      FL$ = "KEYSHOP"
    04      OPEN FL$ + ".POS" FOR RANDOM AS 1 LEN = 80
    05      FOR E = 0 TO 1
    06         FOR A = 1 TO 3: FIELD 1, (A - 1) * 24 AS 01      NULL$, 24 AS E$(A): NEXT
    07         FOR A = 0 TO 9
    08            GET 1, A + 11 + E * 291
    09            FOR B = 1 TO 3
    10               C = A * 3 + B: IF C < 29 THEN EMP$(C + E * 28) = E$(B)
    11      NEXT B, A, E
    12      FOR A = 1 TO 19
    13         FOR B = 0 TO 2
    14            C = A + B * 19
    15            IF C < 57 THEN
    16               LOCATE A, B * 26 + 1
    17               PRINT USING "##.\                     \"; C; EMP$(C);
    18            END IF
    19      NEXT B, A


    Line 01

    This is only for console. In VB6, you have to create a form. A form without any control is equivalent to using CLS in QB.

    Lines 02 to 19 except 16 & 17
    This will still work because manners of accessing files was only improved -- not changed. Syntax for manipulating variables, arrays are to some extent, remains the same.


    Line 16

    LOCATE is not supported in VB6. The equivalent is putting a LABEL control in the form created. You can locate that control anywhere in the form at design time. If you want to relocate that at run-time, you just have to manipulate the label's "left" and "top" properties and the values should be in pixel or twips, depending on the form setup. In console, that value is referred to character x,y location.


    Line 17

    PRINT USING is not supported in VB6. Use the label's caption property instead, to 'print' the desired value and use Format function for that '##.' format.

    Something to Add

    VB6 is event driven. That means you have to create an event that will trigger Lines 02 to 19 to execute. There are lot's of event that you can use.

    I suggest you create a command button as trigger. then select the Click event to create sub/end sub procedure.


    The codes in your form would look something like...

    Code:
    Private Sub Command1_Click()
        DIM EMP$(56)
        FL$ = "KEYSHOP"
        OPEN FL$ + ".POS" FOR RANDOM AS 1 LEN = 80
        FOR E = 0 TO 1
           FOR A = 1 TO 3: FIELD 1, (A - 1) * 24 AS NULL$, 24 AS E$(A): NEXT
           FOR A = 0 TO 9
              GET 1, A + 11 + E * 291
              FOR B = 1 TO 3
                 C = A * 3 + B: IF C < 29 THEN EMP$(C + E * 28) = E$(B)
        NEXT B, A, E
        FOR A = 1 TO 19
           FOR B = 0 TO 2
              C = A + B * 19
              IF C < 57 THEN
                 Label1.Caption = Format(EMP$(C), "##.")
              END IF
        NEXT B, A
    End Sub
    Now, please take note that I did not really check the correctness of your Lines 02 to 19 codes. I dont have copy of your keyshop.pos file and i dont have QB45 anymore. I think the "AS NULL$" in line 06 is misplaced. Just check it at your end. And sorry I already forgot how FIELD work in QB. In VB6, by just looking at it, it will surely generate an error.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: I need code in vb 6.0 it is in qb

    Quote Originally Posted by AioDCS
    And sorry I already forgot how FIELD work in QB. In VB6, by just looking at it, it will surely generate an error.
    From memory, FIELD [#] device-number, number AS string-variable [, number AS string-variable...]
    VB Code:
    1. FOR A = 1 TO 3: FIELD 1, (A - 1) * 24 AS NULL$, 24 AS E$(A)
    could be replaced by a UDT.
    [Edit: Remembered more]
    Last edited by Al42; Jul 26th, 2006 at 02:12 PM.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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