Create a windows application by selecting File->new ->Project then project type Visual C# itself as console application Then in templates select windows application instead of console application.Create in same location as console application ie.. (C:\BegVCSharp\Chapter2). with default name consoleapplication1.After clicking ok you can view an empty window form.Move mouse pointer on toolbar on left side of screen,double click on button option to add button to form.
Double click on button added to window form to display C# code.Modify it to -
private void button1_Click(object sender,EventArgs e)
{
MessageBox.Show("The first window app");
}
Run the application.
Click button when running to see message dialog box.
Exit clicking x.
Features of VS
Here when double clicked on button on toolbar,VS knew that you wanted to write code to execute on click on button by user.
Also without code we can resize,minimize and move around windows form and button.
UI ie, user interface building blocks are on toolbar to perform different functions like button option.
A properties window to make changes like for button option text changed to click me or which is currently set to button1.Other changes can be made are color changing,size changing etc..
Double click on button added to window form to display C# code.Modify it to -
private void button1_Click(object sender,EventArgs e)
{
MessageBox.Show("The first window app");
}
Run the application.
Click button when running to see message dialog box.
Exit clicking x.
Features of VS
Here when double clicked on button on toolbar,VS knew that you wanted to write code to execute on click on button by user.
Also without code we can resize,minimize and move around windows form and button.
UI ie, user interface building blocks are on toolbar to perform different functions like button option.
A properties window to make changes like for button option text changed to click me or which is currently set to button1.Other changes can be made are color changing,size changing etc..
No comments:
Post a Comment