blenderNetworkpatreonblender-logosdheartuserthtimesbookphotopencilmap-markerchevron-rightbancommentcommentstwitterfacebookrsschainnavicongoogle-plusenvelopelinkedinmail-replycalendar-otumblrredditstumbleuponshare-altbloggerflattrflag

Beginners C# Tutorial

Beginners C# Tutorial

Postby themitchel0 » November 26th, 2012, 11:43 pm

Ok this is my first of hopefully many tutorials on the topic of the programming language c#. At the end of this tutorial you will hopefully be able to use if else statements, message box’s, and buttons.

So let’s get started.

SHOW SPOILER
What you need for this tutorial is ether Microsoft visual studios c# express edition 2008 or 2010. The link to download is here: http://www.microsoft.com/express/downloads/#2010-Visual-CS and for 2008 here: http://www.microsoft.com/express/Downloads/Download-2008.aspx#2008-Visual-Basic

Open up your selected coding program and do this, and select new project from ether the button under the file button( located in the upper left hand corner), or from the file button ( File > New project), or by pressing crt+ shift + n. select windows form application. It is the first one on the list.

Image


Drag 1 textbox 1 button onto the form. It should look a little like this: (you can change the buttons text in the properties window which is located in the toolbar or on the right hand side)

Image


We then need to double click on the button. This will bring us to the coding page.

Image


Then type

Code: Select all
if (textbox1.text == "the text that you want it to equal here")
    messagebox.show("what ever you want the message box to show.")
else
    messagebox.show("something else that u wanted to say")


This is what it should look like:

Image


The first line is saying that if the text in the text box is equal to something then this happens. The third line is saying, if anything else happens then do this.

Now if you go into the upper right hand corner of the screen there should be a little green arrow( or a different color depending on which version you have), you could also push f5 or go to the debug menu.

This will run the program that you have made.

Image

This is some basics in C# hope you enjoyed and learned something =)
themitchel0
Pro
Pro
 
Posts: 365
Joined: June 15th, 2010, 8:31 am

Re: Beginners C# Tutorial

Postby IrascibleOne » November 27th, 2012, 12:33 am

Moved this tutorial out of the main part of the site. This move is part of the Move Non-Graphics Tutorials part of the DS task list.

themitchel0, feel free to edit your tut as much as you like. I'll be removing the tutorial from the resources section of the site within the next few days.
Image
User avatar
IrascibleOne
Site Admin
Site Admin
 
Posts: 1540
Joined: July 31st, 2008, 7:14 pm
Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron