Visual Basic 語言逐步解說Visual Basic Language Walkthroughs

逐步解說提供常見情節的逐步指示,使其成為開始學習產品或特定功能區域的最佳去處。Walkthroughs give step-by-step instructions for common scenarios, which makes them a good place to start learning about the product or a particular feature area.

撰寫非同步程式Writing an Async Program
說明如何使用 AsyncAwait 建立非同步解決方案。Shows how to create an asynchronous solution by using Async and Await.

宣告和引發事件Declaring and Raising Events
說明如何在 Visual Basic 中宣告和引發事件。Illustrates how events are declared and raised in Visual Basic.

處理事件Handling Events
示範如何使用標準 WithEvents 關鍵字或新的 AddHandler/RemoveHandler 關鍵字來處理事件。Shows how to handle events using either the standard WithEvents keyword or the new AddHandler/RemoveHandler keywords.

建立和實作介面Creating and Implementing Interfaces
示範如何在 Visual Basic 中宣告和實作介面。Shows how interfaces are declared and implemented in Visual Basic.

定義類別Defining Classes
描述如何宣告類別及其欄位、屬性、方法和事件。Describes how to declare a class and its fields, properties, methods, and events.

在 Visual Basic 中撰寫查詢Writing Queries in Visual Basic
示範如何使用 Visual Basic 語言功能撰寫 Language-Integrated Query (LINQ)Language-Integrated Query (LINQ) 查詢運算式。Demonstrates how you can use Visual Basic language features to write Language-Integrated Query (LINQ)Language-Integrated Query (LINQ) query expressions.

在 Visual Basic 中實作 IEnumerable(Of T)Implementing IEnumerable(Of T) in Visual Basic
示範如何建立實作 IEnumerable(Of String) 介面的類別和實作 IEnumerator(Of String) 介面的類別,以逐行讀取文字檔案。Demonstrates how to create a class that implements the IEnumerable(Of String) interface and a class that implements the IEnumerator(Of String) interface to read a text file one line at a time.

呼叫 Windows APICalling Windows APIs
說明如何使用 Declare 陳述式並呼叫 Windows API。Explains how to use Declare statements and call Windows APIs. 包含如何使用屬性來控制 API 呼叫的封送處理相關資訊,以及如何以類別方法形式公開 API 呼叫的相關資訊。Includes information about using attributes to control marshaling for the API call and how to expose an API call as a method of a class.

使用 Visual Basic 建立 COM 物件Creating COM Objects with Visual Basic
示範如何使用和不使用 COM 類別範本,在 Visual Basic 中建立 COM 物件。Demonstrates how to create COM objects in Visual Basic, both with and without the COM class template.

實作 COM 物件的繼承Implementing Inheritance with COM Objects
示範如何使用 Visual Basic 6.0 以建立包含類別的 COM 物件,並將它作為 Visual Basic 中的基底類別。Demonstrates how to use Visual Basic 6.0 to create a COM object containing a class, and then use it as a base class in Visual Basic.

判斷 My.Application.Log 寫入資訊的位置Determining Where My.Application.Log Writes Information
說明預設的 My.Application.Log 設定,以及如何判斷應用程式的設定。Describes the default My.Application.Log settings and how to determine the settings for your application.

變更 My.Application.Log 寫入資訊的位置Changing Where My.Application.Log Writes Information
示範如何覆寫記錄事件資訊的預設 My.Application.LogMy.Log 設定,並使 Log 物件寫入至其他記錄檔接聽程式。Shows how to override the default My.Application.Log and My.Log settings for logging event information and cause the Log object to write to other log listeners.

篩選 My.Application.Log 輸出Filtering My.Application.Log Output
示範如何變更 My.Application.Log 物件的預設記錄檔篩選。Demonstrates how to change the default log filtering for the My.Application.Log object.

建立自訂的記錄檔接聽程式Creating Custom Log Listeners
示範如何建立自訂記錄檔接聽程式,並將它設定為接聽 My.Application.Log 物件的輸出。Demonstrates how to create a custom log listener and configure it to listen to the output of the My.Application.Log object.

從 Managed 組件內嵌類型Embedding Types from Managed Assemblies
描述如何建立內嵌類型的組件和用戶端程式。Describes how to create an assembly and a client program that embeds types from it.

驗證密碼確實複雜 (Visual Basic)Validating That Passwords Are Complex (Visual Basic)
示範如何檢查強式密碼的特性,並以密碼未通過哪些檢查的資訊來更新字串參數。Demonstrates how to check for strong-password characteristics and update a string parameter with information about which checks a password fails.

在 Visual Basic 中為字串加密和解密Encrypting and Decrypting Strings in Visual Basic
示範如何使用 DESCryptoServiceProvider 類別來加密和解密字串。Shows how to use the DESCryptoServiceProvider class to encrypt and decrypt strings.

在 Visual Basic 中管理檔案和資料夾Manipulating Files and Folders in Visual Basic
示範如何使用 Visual Basic 函式來判斷檔案的相關資訊、搜尋檔案中的字串,以及寫入檔案。Demonstrates how to use Visual Basic functions to determine information about a file, search for a string in a file, and write to a file.

使用 .NET Framework 方法管理檔案Manipulating Files Using .NET Framework Methods
示範如何使用 .NET Framework 方法來判斷檔案的相關資訊、搜尋檔案中的字串,以及寫入檔案。Demonstrates how to use .NET Framework methods to determine information about a file, search for a string in a file, and write to a file.

在 Visual Basic 中保存物件Persisting an Object in Visual Basic
示範如何建立簡單的物件,並將其資料保存至檔案。Demonstrates how to create a simple object and persist its data to a file.

逐步解說:具有使用時產生功能的測試優先支援Walkthrough: Test-First Support with the Generate From Usage Feature
示範如何執行測試優先開發;在這類開發中,您會先撰寫單元測試,再撰寫原始程式碼,以讓測試成功。Demonstrates how to do test-first development, in which you first write unit tests and then write the source code to make the tests succeed.