This is where the add comes

2.C# for beginners:

We have a lot to do so lets get started.

You should see a window as shown below:



In that windows select "Blank App(Universal Windows)" (Its selected by default so don't worry and proceed with the instructions ) and press Alt+n to go to the name column and name the app HelloWorld and press Enter.

(I use Alt+n for going to Name column instead of mouse to navigate on this software.)





Navigating inside the solution explorer is like navigating inside file explorer. To see this, open
This PC >>Documents >> Visual Studio 2015>> projects>> HelloWorld>>HelloWorld.

Now compare the files inside this directory with the files being shown in the solution explorer. If you create a new code file for this project it will be saved in this location. See that the solution explorer is a window that helps you keep track of the files that concerns your current project and bundle them up in a package if you want to sell it in the windows store.

In Visual Studio you will see something similar to the image shown below:



If your white page do not have the same aspect ratio you can always change it in the dialogue box given in the top left of the window (orange box). Notice that my settings is 5” Phone(1920x1080) 300% scale. You can also zoom into and out of the page using the dialog in the left bottom (green box).



If so far no problem, proceed further. We promise you that this will be very interesting and useful.

Do notice that the TextBlock and the Button can be resized , rotated , re-positioned etc, using the mouse alone. Place them where you think is best fitted. Very soon we will use this handy feature to create programs with many Buttons and TextBlocks and learn C# effectively.

Name : myTextBlock
Text:

The following image belongs to the properties window of the Button



• Now select the button and double click on it. It will take you the MainPage.xaml.cs file (you should be able to tell that just by looking at the high-lighted tab at the top, just like a web browser). As you do that you should end up in a page full of codes. See where the cursor is. The cursor should be inside two curly braces "{}". Don't worry and just copy paste the one line given below exactly where the cursor is.

myTextBlock.Text = "Hello World";

• Now press function key F5.

If you had followed the procedures properly, after some time the following screen should appear and you know what to do. ;-)



If anything else happened, like there is a window called the error window then you simply have to do everything all over again. If your output window is different from mine, then don't worry we will get to it later. As long as the app window appears after you pressed F5 and the TextBlock displays "Hello World" when you click "Click Me", you are doing just fine. After testing your program close the program as any other program by clicking the x in top right. You might have to wait a little longer for visual studio to resume its state.

We have to do lot of such programs in future to learn C#. More yet to come so stay tuned. :-o


<< Previous Next >>