Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 1 ICS 012 Visual Programming I Ahmed Esmat Second.

Similar presentations


Presentation on theme: "Slide 1 ICS 012 Visual Programming I Ahmed Esmat Second."— Presentation transcript:

1 Slide 1 http://staff.kfupm.edu.sa/ITC/aesmat/ ICS 012 Visual Programming I Ahmed Esmat aesmat@kfupm.edu.sa http://staff.kfupm.edu.sa/ITC/aesmat/ Second Semester 2004-2005 (042)

2 Slide 2 http://staff.kfupm.edu.sa/ITC/aesmat/ ICS 012 Visual Programming I WEEK 1 v Visual and Event Driven Programming v An Overview of Visual Basic (IDE)

3 Slide 3 http://staff.kfupm.edu.sa/ITC/aesmat/ Aims and Objectives v To understand what is visual and event driven programming v The Visual Basic Programming environment – Background to BASIC – Background to Windows – Visual Basic Environment – Design/Control/Project/Form/Code Windows – Control Properties – Events & Event Driven Programming – Visual Basic Programs

4 Slide 4 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Programming Aims v Aim is to develop the necessary skills to design and construct small-scale interactive software v Aim is to educate you with the fundamental principles of designing and writing programs v Visual Basic will be the target language but skills gained will be applicable to other languages

5 Slide 5 http://staff.kfupm.edu.sa/ITC/aesmat/ Event Driven Programming v Event-driven programs respond to events from the computer, such as the mouse button being pressed. v The designer uses ready-made objects such as CommandButtons and TextBoxes, to build user interfaces that make up the application. v This approach to programming drastically reduces the amount of code required to develop a Windows application.

6 Slide 6 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Programming Languages v Windows easy to use v Programming via Visual environments –.NET – Visual C++, C# – Java, J++, J# – Borland Delphi and others… v Visual Basic developed in-house at Microsoft – Interface designer – Simple coding language – Quick to produce programs

7 Slide 7 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Basic Concepts v Controls - Processing – Everything is a ‘control’ – Controls have pre-defined ‘events’ – Code can be attached to an event – When an event occurs u if code has been attached it is executed, u otherwise default processing takes place

8 Slide 8 http://staff.kfupm.edu.sa/ITC/aesmat/ Running VB Opening screen Select this option - Standard EXE

9 Slide 9 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Basic Environment v Components of the VB Design Environment Form Project Explorer Properties Form Layout Control Toolbox Toolbar

10 Slide 10 http://staff.kfupm.edu.sa/ITC/aesmat/ Event Driven Programs in VB v In normal programming your application is always in control v In GUI(Graphical User Interface) programming you have a number of options which may be triggered v Events happen to a Control – mostly user generated events – controls can also cause events

11 Slide 11 http://staff.kfupm.edu.sa/ITC/aesmat/ Control Toolbox

12 Slide 12 http://staff.kfupm.edu.sa/ITC/aesmat/ Events v Each Control has a relevant set of Events The events that can happen to a Command Button

13 Slide 13 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Basic Environment - Properties Window v Controls - Properties – All controls have appropriate properties such as u Height, Name, Colour – they can be changed either at design-time or at run-time Main Menu v Design Time – Simply change the words alongside the property. Ie

14 Slide 14 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Basic Environment - Properties Window v Run Time – in your code/program Private Sub Form1_load() Form1.Caption = “Main Menu” End Sub

15 Slide 15 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Basic Event Processing Trigger Event Code Executed

16 Slide 16 http://staff.kfupm.edu.sa/ITC/aesmat/ Project Explorer

17 Slide 17 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Basic Program Structure v Project File – ‘.VBP’ v Form Files – ‘.FRM’ – ‘.FRX’ v Modules – ‘.BAS’ v Custom Controls – ‘.VBX’ files v Save As... – Possible problem

18 Slide 18 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Basic Environment - Using Context Sensitive Help v Context sensitive help is very useful v Select the item control that you want help on v Press the F1 key F1

19 Slide 19 http://staff.kfupm.edu.sa/ITC/aesmat/ Command Button Select the command button from the toolbar

20 Slide 20 http://staff.kfupm.edu.sa/ITC/aesmat/ Controls: Shape v A shape control allows you to ‘draw’ on the screen v You can specify the: Shape Colours FillStyle

21 Slide 21 http://staff.kfupm.edu.sa/ITC/aesmat/ Visual Separation of Controls

22 Slide 22 http://staff.kfupm.edu.sa/ITC/aesmat/ Writing VB Programs v Plan the Program Tasks v Design User Interface v Set Properties v Write Code (Event Handlers) v Test and Debug the Program v Document and Distribute the Program

23 Slide 23 http://staff.kfupm.edu.sa/ITC/aesmat/ End of Lecture


Download ppt "Slide 1 ICS 012 Visual Programming I Ahmed Esmat Second."

Similar presentations


Ads by Google