CS0004: Introduction to Programming Visual Studio 2010 and Controls.

Slides:



Advertisements
Similar presentations
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Advertisements

CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Chapter 2 –Visual Basic, Controls, and Events
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 1 Tariq Aziz and Kevin Jones.
Chapter 31 Visual Basic Controls A Form is a windows-style screen displayed by Visual Basic programs. In a form, a programmer can create objects in a form.
Compunet Corporation Programming with Visual Basic.NET GUI Week # 11 Tariq Ibn Aziz.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Introduction to Visual Basic. What is Visual Basic? An environment for developing Windows applications Components –A GUI (Graphical User Interface - gooey)
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
Introduction to Programming and Visual Basic
Chapter 2 –Visual Basic, Controls, and Events
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
Visual Basic Chapter 1 Mr. Wangler.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
IE 411/511: Visual Programming for Industrial Applications
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
Visual Basic 2005 CHAPTER 2 Program and Graphical User Interface Design.
 2009 Pearson Education, Inc. All rights reserved Introduction to the Visual Basic Express 2008 IDE.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Introduction to the Visual Studio.NET IDE (LAB 1 )
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Introduction It is developed to create software applications. It is a tool for developers of any program that uses both basic and expert settings. It.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
CHAPTER TWO INTRODUCTION TO VISUAL BASIC © Prepared By: Razif Razali 1.
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Chapter 2 - VB 2008 by Schneider1 Chapter 2 –Visual Basic, Controls, and Events 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Game Maker – Getting Started What is Game Maker?.
What is Visual Basic.NET? 110 B-1 e.g. a word processor doesn’t do anything until the user clicks on a button, types text... A programming language that.
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 2 The Visual Basic.NET Integrated Development Environment.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 2 - VB 2008 by Schneider1 Chapter 2 –Visual Basic, Controls, and Events 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual.
 You won’t write a single line of program code.  Instead, you’ll use visual programming techniques.  Visual Studio processes your actions (such as mouse.
ALMAJMA'AH UNIVERSITY College of Science and Humanitarians Studies in Alghat Information Technology Section (211Tal course) 1.
ALMAJMA'AH UNIVERSITY College of Science and Humanitarians Studies in Alghat Management Information System Section (211 NMA course) Introduction to Programming.
Dive Into® Visual Basic 2010 Express
Visual Basic.NET Windows Programming
Visual Basic Code & No.: CS 218
Chapter 2 – Introduction to the Visual Studio .NET IDE
An Introduction to Computers and Visual Basic
Program and Graphical User Interface Design
1. Introduction to Visual Basic
An Introduction to Computers and Visual Basic
Program and Graphical User Interface Design
Chapter 2 – Introduction to the Visual Studio .NET IDE
CIS16 Application Development Programming with Visual Basic
An Introduction to Computers and Visual Basic
Presentation transcript:

CS0004: Introduction to Programming Visual Studio 2010 and Controls

Review  Four Stages in a program  Read Input  Validate Input  Process Input  Output Result  An Algorithm is…  A step-by-step procedure devised for the purpose of taking in data and producing the correct output.  What’s the difference between an algorithm and a program?  A program is the actual implementation of an algorithm in a programming language.

Review  When Developing a program in both the real world AND in this class, there are 6 steps 1) Analyze the problem 2) Plan a solution 3) Design an interface 4) Write the code 5) Test and debug 6) Document the program 7) (Not done in this class) Maintain the program

Review  An End User is…  The person whom the program was designed for.  A User-Interface is…  How the user interacts with your program.  A Bug is…  An error, flaw, mistake, failure, or fault in a computer program.  Documentation is…  Organizing all the material that describes the program.  Three models used to help develop an algorithm:  Flow Charts  Hierarchy Charts  Pseudocode

Visual Studio 2010  Visual Studio is an Integrated Development Environment (IDE)  An IDE is a software application that provides comprehensive facilities to computer programmers for software development.  Visual Studio = IDE for developing Visual Basic Programs  Visual Basic = Programming Language  Visual Basic is designed to easily make user-friendly Graphical User Interfaces (GUIs).  A GUI allows the user to interact with programs in more ways than typing. They use graphical representations of objects instead of simply text.  GUIs include:  Icons  Buttons  Drop-down boxes  Etc.

Developing a User-Interface  After you have successfully developed an algorithm for your program you can develop a user-interface.  This is often NOT the first step in development in the real world, but for this class it often will be.  Visual Studio allows you to literally draw the interface, and it writes the code for you.  These interface objects will automatically have basic functionality, and can accept events.  This is not how it works with most other programming languages and IDEs.  You have to write the code for what happens on these events.  Important Note: Event-Driven Programming is fundamentally different than traditional Procedural Programming

Developing a Visual Basic Program  So, how to we add functionality to our interface?  Answer: We write Event Procedures.  An Event Procedure is a set of instructions to be executed when a certain event happens.  For example, we can write an Event Procedure for when we push an “OK” button.  Almost everything in Visual Basic is either an Event Procedure or used by an Event Procedure.  Here’s the basic steps when developing a Visual Basic Program: 1. Design the appearance that the user sees. 2. Determine the events that the controls on the window should respond to. 3. Write the event procedures for those events.

Programming Layer Model  Many event-driven programs can be divided into three important sections or layers:  Presentation Layer – Anything the user sees and how the user interacts with a program.  Logic Layer – How the program acts when it receives events.  Data Access Layer – Allows simple access to persistent storage (like a database). We probably won’t be doing this in this course.  It is important to separate the layers from each other as much as possible.  Why?

Programming Layer Model Presentation Layer Logic Layer Data Access Layer DB

How a Visual Basic Program is Run  When you run your Visual Basic program the following things happen: 1. Your program monitors the controls in the window to detect any event that a control can recognize (mouse movements, clicks, keystrokes, etc.) 2. When your program detects an event, it examines the code to see if you’ve written an even procedure for it. 3. If you have written an event procedure, the instructions in the procedure are executed and it goes back to step If you have not written an event procedure, it ignores the event and goes back to step 1.

Visual Studio Tutorial  New Project  On the opening screen click on “New Project”  Enter a name, a location for your project, and a solution name.  Click on “Windows Forms Application”.  Click the “OK” button.  Open an Existing Project  Click on “Open Project”  Navigate to you “.sln” file and double click on it.  Parts of the IDE:  Menu Bar – Has menus such as: File, Edit, View, Window, Project, Data, and Debug.  Toolbar – Holds buttons that perform common controls.  Document Window – Currently holding the Form Window.  Form Window – What your VB program will look like when you open it.  Properties Window – Used to change how objects look and react.  Solution Explorer – Shows files associated with the program.  Toolbox – Contains controls to put on your form.

Visual Studio Tutorial  Textbox  Creating  Click on the text box tool  Click on the form to create default sized text box  Click and drag on the form to create custom size text box  Click on the text box to select it.  Push the delete key while it is selected to delete it  Properties Window (F4, clicking on it, toolbar button)  Name  Changes what the text box is called  Text  Changes what text is in the text box when the text box first appears.

Visual Studio Tutorial  Button  Properties  Text  Access Key – Putting an “&” in front of the text will give it an access key.  If you press “Alt + the first character in front of the &” it will do the same as clicking the button.  Label  Properties  AutoSize – If true, the text property will decide how big the label is. If false, you can resize it.  Tab Order – Sets the order in which the controls are focused on when the user hits tab.  To set the tab order, number the TabIndex property of the controls starting at 0.

Visual Studio Tutorial  Debugging/Stop Debugging  When you hit the “Debug Button” (The green play button), your program will compile and display what it will do.  You can then test and debug your running program.  To stop debugging either close your program normally or press the “Stop Debugging” button (The blue stop button).  Save All – Saves all files associated with the project  Click on the “Save All” button (The one with three disks) on the toolbar.  Or click on “File” in the menu bar and then “Save All” in the menu.

Naming  The naming (value of the name property) of controls should indicate what it is and what it does.  The name should include both what the object is in the form of a prefix, and what is does or if it doesn’t do anything specific, what it is. ObjectPrefixExample FormfrmfrmPayroll ButtonbtnbtnComputeTotal LabellbllblAddress Text BoxtxttxtCity List BoxlstlstOutput

Alignment of Controls  Often you want your controls to be a comfortable distance away from each other and the edge of the form. Visual Studio makes it easy to do this.  When you drag a control toward the edge of the form or another control, a Proximity Line appears to ensure a comfortable distance is between the control and the other object.  When you drag a control in an area that is close to being either vertically or horizontally aligned with another control, a Snap Line appears to help align the controls.