410 likes | 575 Views
Understanding Programming Concepts and Writing a Simple Visual Basic Application. Chapter 1. Visual Studio .NET. A developmental tool for creating Windows and Web applications. A Windows application is designed to run on a desktop in the Windows interface.
E N D
Understanding Programming Concepts and Writing a Simple Visual Basic Application Chapter 1
Visual Studio .NET • A developmental tool for creating Windows and Web applications. • A Windows application is designed to run on a desktop in the Windows interface. • A Web application is designed to run from a web server using a browser interface.
Visual Studio .NET • A development environment is the comprehensive set of tools and features that allow you to develop, debug, and deploy applications. • An Integrated Development Environment (IDE) is where all the features are made available within a common interface.
Visual Studio .NET • A profile is a collection of settings that defines the appearance of the IDE. • The profile can be customized based on how you choose to work within the environment. • A view defines how the interface elements appear on the screen.
Customize My Profile • My Profile on Start Page • Student Developer • Solution Explorer • Dynamic Help • Start Page • Task List
Customize My Profile • Visual Studio Developer • Get Started
Customize My Profile • Tools|Options
Hiding Tool Windows Automatically • A Pushpin is a small icon appearing in a tool window that determines whether the window will display and hide automatically, also known as Auto Hide.
Hidden Solution Explorer • Mouse over will display the window. • Mouse out will auto hide the window.
Docking Tool Windows • Window|Dockable
Visual Basic .NET • Visual Basic.NET (VB.NET) is one of the language options available in the development environment. • Visual Basic code is contained within a procedure. • A procedure is a block of Visual Basic statements.
Solutions • An application is made of a solution. • A solution is the starting point for creating applications in Visual Studio.NET. • A solution is the container or box that manages all the individual pieces that make up your application. • Solutions contain one or more projects.
Projects • A project can be created using any Visual Studio.NET Language. • A solution can have multiple projects created in different languages. • A project contains files. • The IDEorganizes solutions, projects, and files, and holds all of your work in a hierarchy.
Creating a new VB .NET project • File|New|Project • Windows Application • Name:
Creating a New Project • Type in the name of the project. • IDE uses the project name to create a new folder for each project you create. • Makes file management easier. • Browse for the location to store this project.
Projects • When you create a project, Visual Studio.NET automatically generates a solution. • A solution usually has one or more related projects. • A single solution can consist of multiple projects.
Solution Explorer • Provides an organized view of your solution, projects, and their files. • Common tree-view interface. • Collapses and expands.
Windows Form Designer is the visual workspace for creating the interface for your application.
Online Help • Help|Search • Look for: • Filter by: • Search
Objects • An object is a combination of code and data you can treat as a single unit. • Menu, button, text box, etc. • A form is an object. • The entire application is an object. • A project requires at least one form.
Controls • Controls are objects that make up the user interface. • A form is a container for the controls a user interacts with when using the application. • Text Box • Label • Button
Toolbox • View|Toolbox • Toolbox button • Mouse over
Properties • Characteristics • Attributes • Data • Name • Text
Events • An event is an action that triggers a program instruction. • An object's code specifies what the object will do in response to an event.
Object Methods • A method is a specific action an object can perform when the application is running. • A button has a Hide and a Show method. • Methods determine which actions an object can perform.
Summary • Properties characterize an object's appearance. • Events are the actions to which a control responds. • Methods characterize an object's behavior.
Design Time vs. Run Time • Design time is the state of the application while you are working with a project using the development environment. • Run time is the state of the application while it is running or executing.
Setting Properties • Design Time – Select the object then change values in the Properties Window.
Setting Properties • Run time – Assign a property value using an Assignment statement in VB code that responds to an event. • Object.Property = Value • txtLastName.Text = "Smith"
Naming Objects • Long enough to be meaningful. • Short enough to avoid verbosity. • Must be unique. • 1st character must be letter or underscore. • Naming convention is Modified-Hungarian Notation. • Standards help programmers produce consistent code.
Modified-Hungarian Notation • Uses a lowercase 3-character prefix to indicate the object type.
Procedural Programming • The program specifies the sequence of all operations in a step-by-step manner, and the order of the program statements determine how the computer program will carry out a specific task. • Payroll • There is no user interaction.
Event Driven Programming • Write code that responds to specific events. • There is no set sequence of events. • Objects respond to events in different ways. • Objects and their events are reusable.
Class Name List • Method Name List
Run the Application • Start Button. • Press the Tab key to verify that the tab index property is set correctly. • Test each button. • Stop Debugging button. • File|Close Solution • File|Exit
Saving Files • If changes have been made that have not been saved, an * displays on the Form Designer window tab. • Save All button • The * disappears which indicates that all changes have been saved.