[Beginners]Variables and MessageBox in C# 06-05-2013, 07:25 AM
#1
Hey guys, Sooo... I did a tutorial in VB.Net on Variables, but now its time to do some C# LOL. So anyways, Lets start out with saying, the variable i am going to be working with is a String variable. String variables hold words


![[Image: WhatTheFormShouldLookLike.png]](http://i1126.photobucket.com/albums/l604/Kaopio14/WhatTheFormShouldLookLike.png)
There is Two lables, Two Textboxes, And One Button.
Click on the Button 2 times, and Code for the button should come up, now, just so you are learning, copy the code so your code for the button should look like this:
![[Image: WhatTheCodeShouldLooklike.png]](http://i1126.photobucket.com/albums/l604/Kaopio14/WhatTheCodeShouldLooklike.png)
Now what this code is very simple to understand, The <b>String</b> is declaring that it is a string Variable, and the word after it (firstname) is declaring what you want the name to store the info in. Now the info is stored in the String when you type something into the textbox and press the button, but nothing happens? WTF i wanna make something happen! well lets work on that!
Add this Code now:
![[Image: code.png]](http://i1126.photobucket.com/albums/l604/Kaopio14/code.png)
No if you look a the screen shot, you may say! WTF why is there " " now that is there to declare there is a space and the + is declaring what else you want to add. So you would do MessageBox.Show(); to declare that you are wanting to show the message box, then you put what you want on the inside of it so it would look like this code
Code:
MessageBox.Show("Your Full Name Is: + " " + firstname + " " + lastname);
![[Image: itsspaced.png]](http://i1126.photobucket.com/albums/l604/Kaopio14/itsspaced.png)
wooo hooo you did it, but wait! WTF THERE IS NO TITLE ON THE FREAKING MESSAGE BOX! LOOK AT IT UNDEAD!!!!
fine then lets fix that now all you do is add a comma and put the " " and whatever you want in the " " to say. so say i want it to say Full Name, it would be "Full Name" just to make it more clear, here ya go:
![[Image: code.png]](http://i1126.photobucket.com/albums/l604/Kaopio14/code.png)
So pretty much the comma you do after what you want to be on the inside, will be the title

![[Image: fullname.png]](http://i1126.photobucket.com/albums/l604/Kaopio14/fullname.png)
Thank This Post For The Enthusiasm! Haha oh, and all these screenshots were taken with Dead Shot (a program that i made, it has a few bugs, so its not released.
