vb assign a variable code example Example 1: visual basic how to declare a variable Dim intNumber1 As Integer Example 2: visual basic how to assign a variable intVar1 = 5