Hello MS WindowsC# is a general purpose, object-oriented, programming language and was designed by Microsoft to allow developers develop on Windows applications and Web applications. While designing the language, Microsoft wanted build up on their success with Visual Basic as a Rapid Application Development (RAD) tool. Microsoft wanted to have a programming language that is equally powerful as C and C++ yet have the flexibility and ease of Visual Basic. It was quite a challenge designing C#. It is a given that MS Windows is the dominant desktop operating system. In fact, most operating systems, even Linux, have a graphical user interface (GUI). We have risen from character displays, which is the dawn of computing, to a more sophisticated, event driven graphics driven applications. We also have to pay the price. Programming in a GUI environment is totally different to that of character displays. In a GUI environment, events happen and applications have to respond to events. Unlike in a character-based application, everything is linear. Visual Basic programmers are already familiar with the concept of Forms. In fact it's a not a new concept and other products such as Oracle and Java use the same concept. A from is window, either displayed through the browser or MS Windows, that displays information and other window components to user. Window components are objects such as buttons, text boxes and toolbars. Hence a Windows Form (WinForm) is any displayable window on the Windows desktop. This could either be a dialog box, an SDI / MDI, or any other resizable application. To create a WinForm, you must inherit the Form class, which is part of the System.WinForms namespace. All of Windows components are part of the WinForms base class. Our little skeleton Windows application may start life as follows: Listing 1
Listing 1 contains several concepts that need explaining. Our application is encapsulated in the WinExample class, which is an inherited class from Form. All Windows application must inherit from this class. Like all C# programs, the Main() method is the entry point of the class. In this case it is also the entry point of the program. Notice that Main takes a string argument. This is the same string passed on to Windows applications when it starts. The Application.Run() method starts execution of the application.
The copyright of the article Hello MS Windows in C# Programming is owned by Jose Aniceto. Permission to republish Hello MS Windows in print or online must be granted by the author in writing.
Go To Page: 1 2 Articles in this Topic Discussions in this Topic |