Visual Basic 中的類型轉換Type Conversions in Visual Basic

值從一種資料類型變更為另一種類型的程序稱為轉換The process of changing a value from one data type to another type is called conversion. 轉換為widening或是縮小,取決於相關類型的資料容量。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 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.