更新:2007 年 11 月
给变量或属性赋值。
variableorproperty = value
各部分说明
- variableorproperty 
 任何可写的变量或任何属性。
- value 
 任何文本、常数或表达式。
备注
等号 (=) 左边的元素可以是简单的标量变量,也可以是属性或数组元素。变量或属性不能为 ReadOnly (Visual Basic)。= 运算符将其右边的值赋给其左边的变量或属性。
| .gif) 说明: | 
|---|
| = 运算符也被用作比较运算符。有关详细信息,请参见 比较运算符 (Visual Basic)。 | 
重载
= 运算符只能作为关系比较运算符重载,而不能作为赋值运算符重载。有关更多信息,请参见 运算符过程。
示例
下面的示例演示赋值运算符。右边的值赋给左边的变量。
Dim testInt As Integer
Dim testString As String
Dim testButton As System.Windows.Forms.Button
Dim testObject As Object
testInt = 42
testString = "This is an example of a string literal."
testButton = New System.Windows.Forms.Button()
testObject = testInt
testObject = testString
testObject = testButton