Lesson1 - How to make your first c# programe

10/02/2007 11:35 InsaneCoder#1
hi

today i will be showing you how to make a C# programe veyr very basic
this will give you a genrale idea on some of the stuff on c# this is what you will be needing.

you will need following :-

a computer :P
Windows XP
Visual C # ( i am using 2005 i prefer it but u can choose a updated version
if you choose to)

if you have this YOU ARE READY :D !

lets begin

Step One

open up you Visual c# programe there should be a start page, click on
File and then New Project.. in Name: type Hello World this is our projects name and click on the Windows Application once you have done this sucesfully please click Ok and it will create your form.

Step Two

You will have a Form1 as you can see and right next to it is a tab called
ToolBox. toolbox has all the neceserry buttons, text boxes ect you will be using this in your application in the future and is a big Help.

but for know we will only useing the AB button click and drag this on to your Form1 anywhere is OK just dont place it outside of you form.

you will see know once you let go that a button has been placed you can change the buttons name buttons name and properties but for now i wont tell that maybe in future totrials.

Step Three

go ahead and double click the Button automatically you will see a code interface pops up this is where you will be spending most your time when u code your own software or programs you can switch between the Disgin view and Form1.cs * view on the tabs above i presume they will not be hard to find :P.

Step Four

know for the fun bit when you click on your button a code interface appears you will se somthing like this :-

namespace HelloWorld
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
THIS IS WHERE YOU WILL RIGHT YOUR CODE
}
}
}


looks complicating? dont worry later on will get much easier we will be righting 1 code line in between the curley braces where i have high lighted
what are the curley braces you might ask? {} <<-- they are just to make life easier in between is where you right ur code this is called a code block i would like you to use that termnolgy atm beocoues it will be used in future purposes i dont want you to get confused if you dont right in between them curley braces your code will be invalid and you program wont work

you might ask

private void button1_Click(object sender, EventArgs e)

why dosnt this code be in between the curley braces this is a event handler when you double clicked the button c# IDE - intractive develpmont enviroment automatically added a event ill explain in later toturials what a IDE is so dont worry about it.

to get back on to the point a event handler never bees in between your code line.

Step Five

right know to right the code, where i stated i want you to write the following i would prefrer you dont copy and past coz wont be practical and this will stik in your memory better :D

MessageBox.Show("HelloWorld");

Please follow my toturial and do this....

i will know explain in detail what this code means for the people who dont realy understand...

Messagebox.Show - what this does is once you click your button it will make another little screen that will have your message in it.

(" ") - this brackets are to break your code up and the " " are very imprtant this will be used in the future what they do is tell c# a message is gana be written. if u are gaan write a message it must always start and end with a semi colon "".

; - lastly this is a very imortant code all your codes WILL END WITH THIS; if not you programme will never run it just breaks up a 1 code line to another one. and is very imortant.

Step Six

right so know our code is written go back to your design view, we will test our programme know in debugg view please press F5 on your keyboard and c# will start processing what you write once your the programme appears click your Button1 and a Hello World message will appear :)



Congraulation you have made your first c# programme

this toutrial was amied for NEWLY bigginers in c# Hope you Enjoyed it Please check regulary i will be making a 2nd toturial on Lesson 2 i will be explanning about IDE and how to change properties of your form buttons and start introducing new toolbars and start getting you more familier in the controls.



if you want to ask questions i am willing to answer them :) so dont hasitate
Thx for reading.

InsaneCoder
10/11/2007 22:38 harrypotter2#2
dunno if this should be posted here srrry if it shudnt be but umm wer do i download the pvp private server???:confused::confused::confused:
06/07/2008 01:29 johanson75#3
Quote:
Originally Posted by harrypotter2 View Post
dunno if this should be posted here srrry if it shudnt be but umm wer do i download the pvp private server???:confused::confused::confused:
LMFAO WOW... all i can say.. as for the tut gj :)
06/09/2008 10:01 demeteor#4
well i would suggest you to start with consol app and the move to visuall c
and again better teach em c++ ^^
one more information combilers have differned syntax some times and sysntax from time
but any nice tut ^^ and how typical hello world ^^
06/09/2008 12:24 verT!c4L#5
There are better Tutorials out there, have an eye on your english, for example:

"THIS IS WHERE YOU WILL RIGHT YOUR CODE"

right? god damn, could it be write ? or wrong ? :P
06/09/2008 13:50 demeteor#6
well you know not everyone is nativa lang is english right ? soo
he can been excused if he is not fron england / US


but if his native lang is english then he is unfogivable :p


btw ist a nice TUTORIAL but he could make better
06/25/2008 17:30 MaSTa1^#7
could u post the project??
10/11/2008 21:17 BigJugz#8
Nice job. It is gr8 to c that someone can take the time out of a busy schedule to help others. U rock. Not everyone is willing to help ppl who dont know what they r doing.
11/06/2008 18:20 Hygeru#9
ty, its helpfull