Qbasicnews.com
November 20, 2019, 12:54:34 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Type Mismatch  (Read 3645 times)
jelamb
New Member

Posts: 17


« on: December 07, 2007, 01:45:21 PM »

I get a Type Mismatch Error at the following statement in my program. The output still prints without the last data = TQTY(K). Can anyone see why I am getting this error?
LPRINT SC$(K), ID$(K); "    ";USING "####.##"; UCST(K);"    "; TQTY(K)
Logged
wildcard
*.*
Administrator
__/--\__
*****
Posts: 2369



« Reply #1 on: December 07, 2007, 02:55:27 PM »

Is TQTY a function or an array in your code? It will help us if you post more of your code as the value of K could be the problem.
Logged
jelamb
New Member

Posts: 17


« Reply #2 on: December 07, 2007, 04:38:28 PM »

Here is more of the Code. What do you think?

500 REM PRINT RESULTS FOR THIS CATEGORY
        LPRINT PN$, " ", CAT$
        LPRINT
                FOR K = 1 TO NOR
                LPRINT SC$(K), ID$(K); "   "; USING "####.##"; UCST(K); "    "; TQTY(K)
                TCST = TCST + UCST(K) * TQTY(K)
                NEXT K
        LPRINT
Logged
Moneo
Na_th_an
*****
Posts: 1971


« Reply #3 on: December 07, 2007, 09:03:10 PM »

I get a Type Mismatch Error at the following statement in my program. The output still prints without the last data = TQTY(K). Can anyone see why I am getting this error?
LPRINT SC$(K), ID$(K); "    ";USING "####.##"; UCST(K);"    "; TQTY(K)
I tried your code. You're getting the error because you can't append non-numeric data to be printed after an LPRINT USING or a PRINT USING, like the "     ".

If you need to also format TQTY(K) USING "####.##". Try the following:

LPRINT SC$(K), ID$(K); "   "; USING "####.##"; UCST(K);
LPRINT  "     ";
LPRINT USING "####.##"; TQTY(K)

Regards..... Moneo
 
Logged
jelamb
New Member

Posts: 17


« Reply #4 on: December 08, 2007, 11:00:36 AM »

Thanks Moneo,
That worked nicely. I am using DOSPRN and thought it might have something to do with that program but evidently not.
Thanks again.....John
Logged
Ralph
Ancient Guru
****
Posts: 544


« Reply #5 on: December 08, 2007, 04:20:04 PM »

Moneo:  Nicely solved!
Logged

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!