Saturday 13 May 2017

Understanding "USING" keyword in c# programming

The keyword USING is similar to #INCLUDE in c programming to add the namespaces into the program which we are going to execute. We can write programs without using this keyword too. The bellow two example show how the code is changed with and without including the "USING" keyword in the program.

The program with "USING" keyword:

using System;
class SimpleHelloWorld
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}




The program without "USING" keyword:

class WithoutUsing
{
    static void Main()
    {
        System.Console.WriteLine("Hello World!");
    }
}



Simple Hello World Program

The program is as follows:


using System;
class SimpleHelloWorld
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}

The output is as follows:






Thursday 4 May 2017

Creating a Sample WPF Application in Visual Studio 2015 using Visual Basic WPF

What is WPF(Windows Presentation Foundation) application?

It is a graphical subsystem in windows to render user interface in windows-based applications. WPF works on the base of DirectX which is a set of API's.  


1.Open visual studio 2015 and create a new WPF application with the name Hello:



2.Create two radio buttons:

         To create radio button double click on Radio Button control in toolbox. If the toolbox is hidden, select view menu and click on toolbox (or) use a shortcut "Ctrl+Alt+X".  You can create a radio button on double clicking on radio button which is listed in "Common Wpf Controls".



3.Again create another radio button. And place them by dragging. After dragging and placing both the radio buttons the main window will appear like this.



4.The names behind the radio buttons is "RadioButton" by default. The name of the button can be changed as per our requirement of its use in the application. To change the name of radiobutton select the radiobutton to access the properties of it. And then edit the name in "Content Property" as shown in the figure below.




5.Select each radio button and change the font size and its style as shown in the figure below.



6.Then add a button into the main window by double clicking on the "Button" in the toolbox window. And then change its name is "Display". Adjust the size of the button to look apt to the window size.



7.Double click on the "Display Button" to write the code. The code is about to generate a message box when you click the button in the main window. The message box display different messages based on the selection of hello and goodbye radio buttons. The code is as follows:


Class MainWindow
    Private Sub button_Click(sender As Object, e As RoutedEventArgs) Handles button.Click
        If radioButton.IsChecked = True Then
            MessageBox.Show("Hello")
        Else radiobutton.IsChecked = True
            MessageBox.Show("GoodBye")
        End If
    End Sub
End Class



Then click debug to run the application. 



Wednesday 3 May 2017

How to change the color theme into dark in visual studio 2015

Steps:-

1.First open the visual studio 2015.
2.Select the Tools on the Menu bar.
3.Select Options
4.After selecting the options in the tools menu.
5.In the option window Change the color theme into Dark.
6.Set the color theme into dark and click OK.

You can follow the above steps with the below images.

1.First open the visual studio 2015.



2.Select the Tools on the Menu bar.



3.Select Options


4.After selecting the options in the tools menu.




5.In the option window Change the color theme into Dark.



6.Set the color theme into dark and click OK.



7.After changing the color theme you can view the visual studio like this.