TheCreepySheep TheCreepySheep - 1 year ago 57 Question

Adding value to integer in VB.NET

How do I add +1 value to an integer?

Something like

If myClientMachineIP.AddressFamily = Sockets.AddressFamily.InterNetwork Then
Label2.Text = myClientMachineIP.ToString()
TextBox2.Text = "IP is not equal to IPv4"
proov = +1
TextBox3.Text = proov
End If
Loop Until proov = 10

How do I add +1 to the
integer variable?

Tim Tim
Answer Source


VB.NET does not have the increment operator (++), so the simplest way would be to use the addition assignment operator += Operator:

proov += 1

Another way is to explicitly add 1 to the value:

proov = proov + 1