Hi ! can someone tell me what I did wrong with the code that I attached when I declare 'Option Strict on' ~ seems doesn't work.
Thanks !

With Option Strict on VB will not make any implicit conversions, you have to do it yourself. This is because VB might make the wrong conversion and you will have a terrible time finding it.
Your problem is:

MessageBox.Show(obj.CalculateDistance(10, 10))

With Option Strict off VB converts the obj.... to a string because it judges that is what you want because of the MessageBox.
There are two ways to do this:

MessageBox.Show(obj.CalculateDistance(10, 10).ToString)


MessageBox.Show(CStr(obj.CalculateDistance(10, 10)))

Hope this helps.

Yes ! thank you very much...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.