The easiest way to do this is using the statement "Dim". This will make it so you can declare all of your variables...so for example
Dim mystring as String
This will declare the variable as a String....and you can also do something like this....
Dim mystring as String = "hello"
This will actually give the variable mystring a value which in this case is "hello"
But let's say you want to declare something other than a string...like an integer for example...this can be easily done by setting the variable to an integer instead of a String like this...
Dim mynumber as Integer = 13
When declaring Integer's you do not need to use strings as it is automatically detected...
I hope this tutorial helped you learn a little more about variables in VB.NET!
No comments:
Post a Comment