An introduction to C#, a programming language in the .NET Framework, and its use in creating Windows Form Applications. It also compares C# with VB.NET in terms of their functional equivalence, differences in keywords and syntax, and passing data between forms.
Download C# and Windows Form Application: A Comparison with VB.NET and more Lecture notes C Sharp Programming in PDF only on Docsity!
Csharp User Interface
Windows Form Application based on Csharp
An introduction to C#
4- 2
(^) The .Net Framework is a key Microsoft offering and it provides a Multilanguage environment that enables you to develop , deploy, and run Windows applications, Web applications as well as Web services.
(^) CSharp is an Object-Oriented Language , introduced in the .NET Framework.
C# is a Simple, Powerful , general-purpose and Type-Safe language also Case Sensitive.
C# and VB.Net
4- 4
(^) CSharp and VB.NET are the two primary languages used to program on the .NET Framework environment.
(^) Both languages are use the same framework and they both precompiled into the same byte code and then it is compiled and run at runtime.
(^) So, we can say VB.NET and C# are functionally equivalent. Both C# and Visual Basic.NET share structural similarities with other modern high-level languages such as Java and C++.
(^) Both have different in many features. Primarily keywords are different in each other language.
(^) C# is case sensitive while Visual Basic .NET is not.
(^) Also, it is good to remember that C# statements always terminated by a semicolon (;).
C# and VB.Net
4- 5
(^) The following are some examples of differences between VB.NET and C#.
C# and VB.Net
4- 7
4- 8
Windows Application
4- 10
Windows Form Application
(^) When you right click on Form then you will get code behind window, there you can write your code
(^) For example , if you want to change the back color of the form to Brown , you can code in the Form1_Load event like the following.
4- 11
Pass Data Between Forms
(^) In the above method you can see InitializeComponent() method. This method is automatically created and managed by Windows Forms designer and it defines everything you see on the form. It is better you don't try to modify the InitializeComponent method.
Open a new project and drag two text boxes and a button in the Form1.
(^) Add another form (Form2) in the project and add Label control on it
(^) And we are passing these two textbox values from Form1 to Form
Here, call the constructor of Form2 and pass these values and set these values in form
4- 13
Form on Top of All Other Windows
(^) You can bring a Form on top of an application by simply setting the Form.topmost form property to true will force the form to the top layer of the screen.