Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[Beginners]Variables and MessageBox in C# filter_list
Author
Message
[Beginners]Variables and MessageBox in C# #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 Tongue. Now if you did not read my vb.net tut, cuz you are just reading up on C#, and dont know what a variable is, i am not gonna repeat it, so just go look at my vb one Tongue. Now first, lets start with the view of the form:
[Image: 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]
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]
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);
Now this is going to end up to look like:
[Image: 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]
So pretty much the comma you do after what you want to be on the inside, will be the title Tongue At least thats how "I" think of it as, so now it should look something like this in a finishing product: (the message box)
[Image: 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. Tongue and i need to make an icon)

Reply







Users browsing this thread: 1 Guest(s)