Pemrograman Komputer 2 (visual basic)

2,345 views

Published on

unj fmipa-fisika

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,345
On SlideShare
0
From Embeds
0
Number of Embeds
19
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Pemrograman Komputer 2 (visual basic)

  1. 1. Pemrograman Komputer Pertemuan 02 Visual Basic Environment and Control Bambang Heru Iswanto, Dr.rer.nat M.Si <ul><li>Jurusan Fisika </li></ul><ul><li>Fakultas Matematika dan Ilmu Pengetahuan Alam </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  2. 2. Learning Outcomes <ul><li>Pada akhir pertemuan ini, diharapkan mahasiswa </li></ul><ul><li>akan mampu : </li></ul><ul><li>Menerapkan prinsip – prinsip dasar algoritma menggunakan pseudo code dan flowchart </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  3. 3. Learning Outcomes <ul><li>Pada akhir pertemuan ini, diharapkan mahasiswa </li></ul><ul><li>akan mampu : </li></ul><ul><li>Menjelaskan lingkungan dan kontrol pada Visual Basic </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  4. 4. Outline Materi <ul><li>Why Visual Basic </li></ul><ul><li>Visual Basic Modes </li></ul><ul><li>Visual Basic Controls </li></ul><ul><li>Windows Form Control </li></ul><ul><li>Button Control </li></ul><ul><li>Label Control </li></ul><ul><li>Textbox Control </li></ul><ul><li>MsgBox Statement </li></ul><ul><li>InputBox Function </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  5. 5. Why Visual Basic <ul><li>Fastest and easiest way to create applications for Microsoft Windows </li></ul><ul><ul><li>Complete set of tools which simplify the creation of the graphical user interface </li></ul></ul><ul><ul><li>Rapid prototyping tool </li></ul></ul><ul><li>Internet capabilities (VBScript language) </li></ul><ul><li>It can be used as a tool to develop front-end applications for database systems </li></ul><ul><li>Microsoft estimate that there are over 3 million VB developers world wide </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  6. 6. Visual Basic Modes <ul><li>Design Mode </li></ul><ul><ul><li>Placing, arranging, and customizing the appearance of buttons, labels, and other controls on a form. </li></ul></ul><ul><ul><li>Writing processing scripts (source code). </li></ul></ul><ul><ul><li>Saving the solution. </li></ul></ul><ul><ul><li>Making an executable file. </li></ul></ul><ul><li>Run Mode </li></ul><ul><ul><li>Executes the solution. </li></ul></ul><ul><ul><li>Used to evaluate the workability of a part of the project. </li></ul></ul><ul><ul><li>Used to show the user how the solution will work. </li></ul></ul><ul><li>Break Mode </li></ul><ul><ul><li>Helps the developer with debugging. </li></ul></ul><ul><ul><li>Enables the developer to switch back to run mode or design mode. </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  7. 7. VB Integrated Development Environment (IDE) Tool box Tool bar Menu bar Properties Window Form layout window Project Explorer window Title bar Form Window 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  8. 8. Visual Basic Controls <ul><li>Trigger: Initiate processing </li></ul><ul><ul><li>Ex. Button, MainMenu, and Timer </li></ul></ul><ul><li>Input: Get data from user </li></ul><ul><ul><li>Ex. TextBox, RadioButton, and CheckBox </li></ul></ul><ul><li>Output: Display results to user </li></ul><ul><ul><li>Ex. Label, DataGrid, and ListView </li></ul></ul><ul><li>Organize: Group other controls </li></ul><ul><ul><li>Ex. Form, GroupBox, and Panel </li></ul></ul><ul><li>Data Access: Interface with databases </li></ul><ul><ul><li>Ex. Entire Data Group and DataGrid </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  9. 9. Windows Form Control <ul><li>The window that is displayed when the application is running. </li></ul><ul><li>The IDE automatically creates a Windows Form when you start a new project. </li></ul><ul><li>This form will hold or “contain” other controls. </li></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  10. 10. Button Control <ul><li>React to the click of the use </li></ul><ul><li>Perform a task associated with the name of the button that is displayed on its face. </li></ul><ul><li>Appearance and Use: </li></ul><ul><ul><li>Appears as a rectangular-shaped control on a form. </li></ul></ul><ul><ul><li>Its face can display text, an image, or both. </li></ul></ul><ul><ul><li>The face of the button should clearly indicate its function. </li></ul></ul><ul><li>Properties: </li></ul><ul><ul><li>The most common properties of the Button control are listed. </li></ul></ul><ul><ul><li>Most properties are available for every control. </li></ul></ul><ul><li>Events: </li></ul><ul><ul><li>Components are able to respond to events. </li></ul></ul><ul><ul><li>The click event is generated when the user clicks the mouse button. </li></ul></ul><ul><ul><li>You write code to handle events. </li></ul></ul><ul><ul><li>Double-click the Button control to automatically open the code window. </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  11. 11. Label Control <ul><li>Used to display information to the user. </li></ul><ul><li>Used to label other controls or show results of a calculation. </li></ul><ul><li>Appearance and Use: </li></ul><ul><ul><li>Appears as a rectangular area that can be filled with text. </li></ul></ul><ul><ul><li>You have some control over size and alignment of text. </li></ul></ul><ul><ul><li>You can include a border around the label. </li></ul></ul><ul><li>Properties: </li></ul><ul><ul><li>Many of the Button control properties apply to the Label control. </li></ul></ul><ul><ul><li>The Text Property is the most-used property for the Label control. </li></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  12. 12. Textbox Control <ul><li>Provides an area for the user to type while the program runs. </li></ul><ul><li>Appearance and Use: </li></ul><ul><ul><li>Displays as a rectangular area that provides the user a place to type. </li></ul></ul><ul><ul><li>You can limit the user types </li></ul></ul><ul><ul><li>You can also surround the TextBox with a border. </li></ul></ul><ul><li>Properties: </li></ul><ul><ul><li>Some of the TextBox control properties are only available at run time. </li></ul></ul><ul><ul><li>The value of the Text property is used most frequently. </li></ul></ul><ul><ul><li>Control of user entry is shared between properties and events. </li></ul></ul><ul><ul><li>The PasswordChar property allows you to set a security character. </li></ul></ul><ul><ul><li>TextLength property determines the number of characters contained in a textbox. </li></ul></ul><ul><ul><li>Selection… properties provide information on user selections in the TextBox control. </li></ul></ul><ul><li>Events: </li></ul><ul><ul><li>Focus means the user is currently working with the specific control. </li></ul></ul><ul><ul><ul><li>Enter - Occurs when input focus is received. </li></ul></ul></ul><ul><ul><ul><li>KeyPress - Occurs when a key is pressed while the control has focus. </li></ul></ul></ul><ul><ul><ul><li>Leave – Occurs when input focus leaves the control. </li></ul></ul></ul><ul><ul><li>Methods </li></ul></ul><ul><ul><ul><li>Enable the developer to manipulate text in a TextBox. </li></ul></ul></ul><ul><ul><ul><li>Many are available to the developer. </li></ul></ul></ul>01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  13. 13. <ul><li>The MsgBox statement will display information that requires user intervention. </li></ul><ul><li>Example: </li></ul><ul><ul><li>MsgBox(&quot;This is an example of a message box, please press OK to return to the application&quot;, vbDefaultButton1, &quot;Message Box Sample&quot;) </li></ul></ul>MsgBox Statement 1 2 3 1 2 3 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  14. 14. Inputbox Function <ul><li>The InputBox() function requests information from the user with a dialog box. It requires user intervention. </li></ul><ul><ul><li>InputBox(&quot;Enter a value&quot;, &quot;InputBox Sample&quot;) </li></ul></ul>© 2010 Universitas Negeri Jakarta | www.unj.ac.id |
  15. 15. TERIMA KASIH 01/02/11 © 2010 Universitas Negeri Jakarta | www.unj.ac.id |

×