Type Mismatch - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: Type Mismatch (/thread-10073.html) |
Type Mismatch - jelamb - 12-07-2007 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) Re: Type Mismatch - wildcard - 12-07-2007 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. Re: Type Mismatch - jelamb - 12-08-2007 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 Re: Type Mismatch - Moneo - 12-08-2007 (12-07-2007, 09:45 PM)jelamb link Wrote: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?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 Re: Type Mismatch - jelamb - 12-08-2007 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 Re: Type Mismatch - Ralph - 12-09-2007 Moneo:Â Nicely solved! |