So let's look a little on how we can declare variables / values.
First of all we have mainly two ways we declare a variable.
Okey, here I have done two things.
I declared a variable with the 'name' - Name.
But I didn't 'declare' the content of the variable Name.
I declared a variable with the 'name' - Name2.
But here I did declare the content, as "Jorndel" - My Online Name
(Note, if you see the RED line under the: Name in the If statement. That means it can't use something that is nothing to check it with a variable that is something. (Your Program would not be able to debug...)
(Now, you see the RED line is gone? That is because we didn't create it in the same method as we used it in.)
The same here as before. (The First and Second)
But this time I made it 'public'. That means I can use it in any of my events / methods I am to make.
This allow you to set the value: Name to something in an other method / event and then use the button1_click event to check if the name is 'Jorndel'
Let me Demonstrate:
As you see, now I sat the value of Name equal to "Jorndel". (By pressing the Button2
Mark: When you use 1: = that means you set a value to the variable. 2: == Means you check the value.
Look more on these 'checking' ways here: Operators