"Type Mismatch Error"

Code tips and tricks for beginners
Post Reply
Zim
Posts: 280
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 251 times
Been thanked: 128 times

"Type Mismatch Error"

Post by Zim »

If you are a newbe like me, you will eventually get this error. Likely its because you have to convert a number to a string or string to a number to end up with both statements the same in a line of code.
I use this to remind me:

Code: [Local Link Removed for Guests]


'  xxxxxxxxxxxxxxxxxxxx  Number to String: xxxxxxxxxxxxxx
mynumb = 123
mystrng$ = str$(mynumb)    ' mystrng$ now equals 123 using  " str$ "


'xxxxxxxxxxxxxxxxxxxx String to Number: xxxxxxxxxxxxxxxx

mystrng$ = "246"
mynumb = val(mystrng$)   ' mynumb now equals 246  using   " val "



I am a beginner too, so if you see an error, please feel free to comment or correct me! :)
Post Reply