Answer:
A. for defining the procedural level variable intLocal with an integer datatype can be declared in visual basic as below:
Dim intLocal As Integer =23
B. Remember the static is declared using shared variable in visual basic and it means same copy will be available for all instances, and the class variable are being declared as below.
Like, Shared intStatic As Integer = 25
and Dim intClass As Integer =23
C. Now we declare a constant intOne
Const IntOne = 2 outside all methods, so that it has the class level scope.
Now, We need to write:
Label1.Text = intLocal + intOne
Label2.Text = intStatic + intOne
Label3.Text = intClass + intOne
label1 displays inLocal incremented value, and so on.
D. All are displayed through same code.
Note: we can increment each variable through variable as well, rather than with the help of Label.
Explanation:
Public Class Form1
Dim intClass As Integer = 23
Shared intStatic As Integer = 25
Const intOne = 2
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim intLocal As Integer = 23
Label1.Text = intLocal + intOne
Label2.Text = intStatic + intOne
Label3.Text = intClass + intOne
End Sub