O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Type Safety

.NET languages follow the rule of type safety. Type safe means that you can’t just mix different types randomly during assignments. For example, the following line will not compile and causes the error message shown in Figure 1-8:

Dim aDifferentString As String
aDifferentString = 1.23
Type safety in .NET enforces the rule that only equal or safe types can be assigned implicitly to each other.

Figure 1-8. Type safety in .NET enforces the rule that only equal or safe types can be assigned implicitly to each other.

Note

By default, Visual Basic .NET simulates the non-existent type safety used by Visual Basic 6.0 and Visual Basic for Applications (for example, for macro programming in Microsoft Word or Microsoft Excel). You can (and should) change this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required