COP2360 – C# Programming Chapter 10ish – Oct 28. Before we Start Go grab the Chapter 9 Example Zip files, un zip it and put it on your thumb drive and.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Advertisements

Chapter 1: An Introduction to Visual Basic 2012
Microsoft Word 2010 Lesson 1: Introduction to Word.
LSP 121 Access Forms, Reports, and Switchboard. Access Forms.
11 ASP.NET Controls II Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Inventory Throughout this slide show there will be hyperlinks (highlighted in blue) follow the hyperlinks to navigate to the specified Topic or Figure.
Key Applications Module Lesson 12 — Word Essentials
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.
Access Ch 5 Review.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
1 Windows Printing. 2 Objectives You will be able to Output text and graphics to a printer. Print multipage documents. Use the standard Windows print.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services.
CS 2340: Programming in VB Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
Visual Basic Chapter 1 Mr. Wangler.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
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 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Introduction to Matlab & Data Analysis
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.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
1 Working with Menus and Dialog Boxes. 2 Objectives You will be able to Create and edit menus for Windows Forms applications. Write code to handle menu.
CSS/417 Introduction to Database Management Systems Workshop 2.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
GUI development with Matlab: GUI Front Panel Components 1 GUI front panel components In this section, we will look at -GUI front panel components -Programming.
Moodle (Course Management Systems). Managing Your class In this Lecture, we’ll cover course management, including understanding and using roles, arranging.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
In the next step you will enter some data records into the table. This can be done easily using the ‘Data Browser’. The data browser can be accessed via.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Introduction to Visual Basic.NET Your First Visual Basic.NET Application.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
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”
Microsoft Access 2010 Chapter 10 Administering a Database System.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Controls. Adding Controls to Form -You can pick controls from the toolbox. -To add the controls from Toolbox to the Form You have be in design view. -To.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Copyright © Curt Hill More Components Varying the input of Dev-C++ Windows Programs.
JavaScript, Fourth Edition
COP 2360 – C# Programming Final Review. Programming Language Basics A way to store and retrieve information to and from memory. A way to communicate with.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
 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.
Key Applications Module Lesson 12 — Word Essentials Computer Literacy BASICS.
 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.
Excel Tutorial 8 Developing an Excel Application
Chapter 1: An Introduction to Visual Basic 2015
Building a User Interface with Forms
Using Procedures and Exception Handling
Visual programming Chapter 3: GUI (Graphical User Interface) Part I
Multi-form applications and dialogs
Simple Windows Applications
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

COP2360 – C# Programming Chapter 10ish – Oct 28

Before we Start Go grab the Chapter 9 Example Zip files, un zip it and put it on your thumb drive and open the solution.

Annoucements Exam 2 is Next Week (November 4) – Covers Chapter 4 and Chapters 7 through 10 – Similar to Exam 1 70% Short Answer/Essay – You select – Closed Book/Closed Notes 30% Programming – Windows Form Program November 11 is a Holiday (Veterans Day) – No Candy For You!! I’m setting up a Grade Book in Blackboard for the course.

Quick Review Console Apps vs. Windows Apps Console Apps have a specific start and end with usually minimal “outside” interaction. – Many times used for batch processing – Although there can be different processing paths depending upon input or data, the paths are relatively fixed. Windows Apps are reliant on the user “doing” something on a form. – Entering data, pushing a button, selecting from a drop-down. – Every execution is potentially different because it all depends upon the interaction of the user. – The program basically sits there and waits for the user to do something. – Each control on the form has many events that it can react to. Each event can have a different set of code to process that event.

Quick Review Windows Forms applications creates three initial files – Form1.cs: normally this is the only one you edit – Form1.Designer.cs: holds the auto generated code (look but don’t touch!!) – Program.cs: contains the Main( ) method, where execution always begins (Don’t touch this either!!) – Just FYI. The names (Form1 and Program) may be changed based on what you want to call the program – Notice the “Partial Class” designation in the Form1 source files…It takes two to tango. – Notice the extra designation “: Form” on the class definition public partial class Form1 : Form This indicates that the class is inheriting all of the properties and methods of the general Form class.

Control Properties Properties of a control describe how that specific control is to look or function on a particular form. – All forms have certain properties that they inherit from their parent classes – Specific controls then have their own set of properties in addition to the inherited ones.

Control Event Handlers Event Handlers are the links between what a users “does” to a control and what code is executed for that event. Each control has a default “Event Handler” (many times click) that you can get to by simply double clicking the control. But, there are many other events that can also be identified and handled. – For a specific control, they are listed under the “lightening bolt” properties for that control.

What Other Controls are Available in Windows Forms? Text Controls – Labels A control that cannot take user input but can be manipulated programmatically. Used for titles or messages. – Text Boxes A control that may or may not allow input (depending upon the way it is set up.) May be single line or multi-line – Masked Text Box Allows developer to define the format of the data for entry – Rich Text Boxes Has the abilities of a regular text box PLUS users can change formats and fonts (like they can do in Word) (but you have to program it be able to do that!!)

What Other Controls are Available in Windows Forms? Selection Controls – Radio Buttons – Can select exactly one from a group. To allow for multiple series of Radio Buttons, can be placed inside of other controls. – Panels and Group Boxes. – Check Boxes – Can select none, all or anything in between – Drop-Down Lists/Combo Boxes Can usually select only one, but does allow for multiple selections. Requires one to load values to the list.

What Other Controls are Available in Windows Forms? Data Controls – We’ll get more into this when we get into database access – List Boxes – List Views – Data Grid Views – Combo Boxes

What Other Controls are Available in Windows Forms? Layout Controls – Grouping Panels Group Box Tabs – Navigation Scroll Bar Splitter – Program Flow Menu (including right click menu) Tool Strip Timer – Other Progress Bar Picture Box

Message Box Stuff MessageBox Overloads MessageBoxButtons – When we use the Buttons, the MessageBox.Show method will return a value The value return is an “enumeration” type – which basically is an integer that has been given a “name” The variable to which it is assigned is of type var (You could also just use it in the if statement directly…why can we do that??) – It is compared to attributes of the DialogResult class

Some Often Used Properties Visible Enabled

Let’s Play Some More with Our Course Evaluation Clicking the Stupendous radio button checks the Fit check box and disables it. Checking any other one undoes the above. Clicking the Fabulous radio button causes the Fit check box to become invisible. Checking any other one undoes the above. Clicking the picture will cause a message box asking if the picture should be removed. If yes is answered, remove the picture.

Tooltips Control needed so that other controls can display ToolTips Not real sure why they did it this way. Drag and drop the control on the form…It goes to the bottom. Let’s add a ToolTip to our Evaluation – Hovering over the command button will pop a message that says “Hurry up and Press the Button!!”

Menu Strip Let’s add one to our Evaluation: – File -> Clear – Help & thing – Keyboard Shortcut

Open File Dialog Pre-packaged process that allows a user to navigate through a Windows directory structure and select a file. – Drag from the Tools. Notice where it goes – Then used with some other event to get the file name of a file.

Text Box Single Line Multi-Line

Let’s Put This Together into a Program Have a Menu with File->Open and File->Write – File->Write will be disabled until a File is opened. Have a Multi-Line Text Box Have a File Dialog where the user can select a file to bring into the Text Box to be Edited Introduce new I/O methods (some of you used in Hangman!!) – StringVar = System.IO.File.ReadAllText (FileName) – System.IO.File.WriteAllText (FileName, StringVar)

Timer A control that “fires” an event at certain intervals – Let’s add an “auto save” to our Notepad program. Drag and drop it from the toolbox and give it a name and set some properties. Set up it’s event. Start it up in your program. Best bet is to stop it when the timer fires, do the work and then start it again when the work is done so that by chance it isn’t started twice.

Resizing Usually when changing the size of a form, you may want to reposition or change the size of the controls on the form. The Resize Event Handler can be used to do that. – Add a Resize Event Handler to our Mini Text Editor so that as the size of the form changes, so does the editor window.

Dynamically Creating Controls Controls are just instances of classes – Which means you can create them on the fly within the program But you really need to know what you are doing!! Let’s add an Exit button to our Course Evaluation form one step at a time. – Create the button and give it a name (btnNew). – Locate and size it and give it a caption. – Add it to the form this.Controls.Add(btnNew) – Add an Event Handler for it. btnNew.Click +=new EventHandler (btnNew_Click);

Event Handler Information What is this “sender as object” thing? – The event handler has no clue what was done to trigger the event, only that it was called. – What Type of variable is an object value or reference So, what is being passed in And what can we do with it. What is this “e as EventArgs” thing? – Certain events may return arguments depending upon how they were fired. – We’ll look at one when we get to Web ASP.NET Development

A Word on Event Handlers Once an Event Handler is Written, it can be called by many different events You can also have common code created in a separate method with event handlers for each unique event, and the event handlers then call the common code. – I’m for the second way…Why?

Assignment 4 Brought to you by Google – If you get an error message you don’t understand – If you don’t know how to do something – If you’re in need of information to do a research paper GOOGLE IT – Literally ask the questions. 99% of the time you’ll get the correct answer back. – One site that I use ALL the time is StackOverflow.Com

Assignment 4 Part 1 is due no later than Friday, November 6 by 11:59 PM and is worth 4 points. You can only get these points if you complete the work in Part 1 on time. Part 2 is due no later than Wednesday, November 18 by 11:59 PM and includes 6 points (plus possibly 2 extra credit points).