Visual Basic 中的类型转换Type Conversions in Visual Basic

将值从一种数据类型更改为另一种类型的过程称为 转换The process of changing a value from one data type to another type is called conversion. 转换可以是 扩大收缩转换,具体取决于所涉及的类型的数据容量。Conversions are either widening or narrowing, depending on the data capacities of the types involved. 它们也是 隐式显式的,具体取决于源代码中的语法。They are also implicit or explicit, depending on the syntax in the source code.

本节内容In This Section

Widening and Narrowing ConversionsWidening and Narrowing Conversions
说明按照目标类型是否可以保存数据进行分类的转换。Explains conversions classified by whether the destination type can hold the data.

隐式转换和显式转换Implicit and Explicit Conversions
讨论 Visual Basic 自动执行这些转换的分类转换。Discusses conversions classified by whether Visual Basic performs them automatically.

字符串和其他类型之间的转换Conversions Between Strings and Other Types
说明如何在字符串与数字、 Boolean 或日期/时间值之间进行转换。Illustrates converting between strings and numeric, Boolean, or date/time values.

如何:在 Visual Basic 中将一个对象转换为其他类型How to: Convert an Object to Another Type in Visual Basic
说明如何将变量转换 Object 为任何其他数据类型。Shows how to convert an Object variable to any other data type.

数组转换Array Conversions
逐步介绍在不同数据类型的数组之间进行转换的过程。Steps you through the process of converting between arrays of different data types.

数据类型Data Types
介绍 Visual Basic 数据类型,并说明如何使用它们。Introduces the Visual Basic data types and describes how to use them.

数据类型Data Types
列出 Visual Basic 提供的基本数据类型。Lists the elementary data types supplied by Visual Basic.

数据类型疑难解答Troubleshooting Data Types
讨论在使用数据类型时可能出现的一些常见问题。Discusses some common problems that can arise when working with data types.