Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Error in following line, please help
Dim num As Short = CShort(1152712705)


What I have tried:

Googling from last entire week.
Posted
Updated 24-Dec-22 0:28am
Comments
Member 15627495 24-Dec-22 5:36am    
https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/data-types/short-data-type

//
you're casting to short a 'long' , it's fail because of type mismatch.

1 solution

A short value has only 16 bits, one of which is used to determine sign: it is positive or negative? As a result, the largest positive number you can fit into a short is 32767. Your value vastly exceeds that and requires an integer (32 bits) or long (64 bits)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900