Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

C# tutorial for beginners. WIP

So most people will start off a tutorial with some "hello world" shit.

Here I'll give you a tutorial on a program that you can make and easily add your own code to.

For this tutorial we will be coding in C#

To follow the steps in this tutorial you should download and install visual studio 2015 which can be found here.

Once you have downloaded and installed visual studio you should press file in the top left corner, new project and then choose visual C# windows forms application, name the solution Windows run utility - or whatever you desire.

Your screen should look something like this:
[Image: f66742fe84a8ffaf7a5449111138f1f8.png]

Next press okay your next screen should look like this:

[Image: 1b2702f017a92d77a8349d4499b7745e.png]

Next we want to add some buttons to our application you can do this by opening the toolbox from the toolbox tab on the left of the screen.

Go ahead and double click the object called "button" from the toolbox, this will add a button to your windows form as seen below.

[Image: f0f1b24a2b6312407e2409ce2d471f6a.png]

Your form should now look like this.

[Image: fdf4eb05c8650233d662b7fb54cab40b.png]

Now let's give that button a click event. Double click the button (By double clicking the button visual studio will automatically generate some code that will make that button perform a click event - a click event will run code that we will add next.)

The code that visual studio generates will look something like this:

[Image: 4c1f499a7563eaff664c87c9fed9fef7.png]

Now let's add the name space using System.Diagnostics; to the top of our code like this

[Image: b4964ebdde009c14d1cd374a0cae0f81.png]

Next we need to add a process to run, this will be the main attraction of this program.

Process.Start("Taskmgr.exe");

Copy and paste the above code into the click event.

like so:

[Image: 25695d6c3718e3d8f22deaf65a7e3eef.png]

Now we need to debug our program, and test it.

You can do this by pressing the green play/run button.

[Image: 276f21480ae234ef1cf73fc4f560a435.png]

As you can see by testing the program it succesfully executes task manager.

[Image: ce7d024ef027fa3969cb7e4076689675.gif]

Now we can save all and build the file and our program is complete, you can add more buttons and repeat the first steps and add some of your own processes to it too, if you want to know the process name go to task manager, right click the task and go to properties.

for more information check here https://msdn.microsoft.com/en-us/library....110).aspx
(Sep 24, 2016 02:48 PM)Hawk HF Wrote:  That was a wonderful tutorial.
Thank you.

Sorry work in progress :P
(Sep 24, 2016 02:53 PM)Wakka Wrote:  Sorry work in progress :P

In the future, use the "Preview Post" button rather than posting and editing.
Also might want to replace "Once you have downloaded and installed visual basic" to "Once you have downloaded and installed Visual Studio " 😝

🤝
(Sep 24, 2016 03:14 PM)Hawk HF Wrote:  In the future, use the "Preview Post" button rather than posting and editing.

Don't tell me what to do - I know how "Preview Post" works I never previewed post because sometimes my browser times out and I lose progress.

I included WIP in the title so that people would know it is a work in progress.

However I appreciate your concerns, this section is one of the few high quality sections still around and I hope to contribute to it.
(Sep 24, 2016 03:30 PM)GuRuHaX Wrote:  Also might want to replace "Once you have downloaded and installed visual basic" to "Once you have downloaded and installed Visual Studio " 😝

🤝

Thanks 🤫 I did too much VB lately xD
(Sep 24, 2016 03:36 PM)Wakka Wrote:  Don't tell me what to do - I know how "Preview Post" works I never previewed post because sometimes my browser times out and I lose progress.

I included WIP in the title so that people would know it is a work in progress.

However I appreciate your concerns, this section is one of the few high quality sections still around and I hope to contribute to it.

What i do is copy the content first (to make sure its not lost since im not the fastest typer) and than preview post but thats up to you 😝

🤝
(Sep 24, 2016 03:36 PM)Wakka Wrote:  Don't tell me what to do - I know how "Preview Post" works I never previewed post because sometimes my browser times out and I lose progress.

No need to get defensive... If you're worried about losing content, copy and post your post somewhere offline. Something simple like Notepad should suffice.
It might be a good idea to add spoilers for your images as well.
(Sep 24, 2016 04:44 PM)Hawk HF Wrote:  No need to get defensive... If you're worried about losing content, copy and post your post somewhere offline. Something simple like Notepad should suffice.
It might be a good idea to add spoilers for your images as well.

I am adding spoilers last. Thanks anyway.
I've seen hf tutorials for C#, but I haven't seen any for absolute beginners. Setting up the coding environment is a frequent obstacle
(Sep 24, 2016 08:55 PM)jujuger Wrote:  I've seen hf tutorials for C#, but I haven't seen any for absolute beginners. Setting up the coding environment is a frequent obstacle

Hmm, my next thread will cover this.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by Kashmiri HunterMar 11, 2017 08:48 AM 4 373 Mar 11, 2017 08:48 AM
Last Post: Praet0rian
[.NET] by Mr ReddingtonSep 14, 2016 01:07 PM 8 327 Sep 14, 2016 01:07 PM
Last Post: Methylone
[Python] by lovac1Jul 15, 2014 12:25 PM 1 83 Jul 15, 2014 12:25 PM
Last Post: Only3