300 likes | 555 Views
2. Console V/S Windows Applications. Compiler switch names
E N D
1. 1 Hello,Windows Forms
PRESENTED BY
Minu Puranik
And
Vivekananthan Murugesan
Summer 2002
2. 2 Console V/S Windows Applications Compiler switch names target.
For console we write
/target:exe
For console we write
/target:winexe
Console Application gets keyboard input through
Console.Read
Console.ReadLine
Windows Forms Applications gets keyboard(and other) input through EVENTS
3. 3 Building your first application Steps Involved
Run Microsoft Visual Studio.NET.
4. 4 Building your first application Steps Involved In start page click New Project.
5. 5 Building your first application Steps Involved In the New Project dialog box select Project Types: Visual C# Projects.
Under Templates select Empty Project
6. 6 Building your first application Steps Involved Right click References in the Solution Explorer and add reference to the following files.
System.dll
System.Drawing.dll
System.Windows.Forms.dll
7. 7 Building your first application Steps Involved The following dialog box pops up
8. 8 Building your first application Steps Involved Click on file and New Item Menu
Select Local Project Items from categories
and Code File from templates.
This step is very essential as it dissuades Visual Studio.NET from generating code for us
9. 9 Building your first application Steps Involved
Add New Item Dialog Box:
10. 10 Building your first application Steps Involved We are all set to write code now
11. 11 The Message Box MessageBox class
- Displays a Message Box that contains
Text,Buttons and Symbols that inform and instruct the
user.
MessageBox is derived from Object
- Inherits a few methods implemented by Object
MessageBox implements static method Show
12. 12 MessageBox
13. 13 Message Box
14. 14 Message Box
15. 15 Message Box MessageBoxButtons Enumeration.
OK--------------------?0
OK, Cancel-----------?1
Abort, Retry, Ignore?2
Yes, No, Cancel------?3
Yes, No---------------?4
Retry, Cancel--------?5
16. 16 Message Box MessageBoxIcon Enumeration.
None----------?0x00
Hand-----------?0x10
Question-------?0x20
Warning--------?0x30
17. 17 Message Box MessageBoxDefaultButton Enumeration.
Button1----------?0x000
Button2-----------?0x100
Button3----------?0x200
18. 18 Message Box Returning values from a MessageBox
In .NET MessageBox returns one of the DialogResult enumerated values, again corresponding to the button which was clicked.
None-----------------?0
OK--------------------?1
Cancel----------------?2
Abort-----------------?3
Retry----------------?4
Ignore----------------?5
Yes ------------------?6
No--------------------?7
19. 19 Message Box Returning values from a MessageBox
DialogResult dr;
dr=MessageBox.Show("Click a button", "", MessageBoxButtons.YesNoCancel);
if (dr==DialogResult.Yes) {
// code for Yes here
}
else if (dr=DialogResult.No) {
// code for No here
}
else {
// code for Cancel here
}
20. 20 The Form
21. 21 The Form
22. 22 Show Form
23. 23 Application.Run method
24. 24 Form properties
25. 25 Events
26. 26 Handling the Paint Event
27. 27 Inheriting Form class
28. 28 Inheriting Form class
29. 29 Inheriting Form class
30. 30 Inheriting Form class
31. 31 Inheriting Form class