Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.

Slides:



Advertisements
Similar presentations
Driving Test 1 Marking Scheme Focus on five areas to pass driving test 1.
Advertisements

11 ASP.NET Controls II Beginning ASP.NET 4.0 in C# 2010 Chapter 6.
Copyright © 2012 Pearson Education, Inc. Chapter 2 Introduction to Visual C#
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 3 Tariq Aziz and Kevin Jones.
Graphical User Interfaces A Quick Outlook. Interface Many methods to create and “interface” with the user 2 most common interface methods: – Console –
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
Slide 1 Chapter 2 Visual Basic Interface. Slide 2 Chapter 2 Windows GUI  A GUI is a graphical user interface.  The interface is what appears on the.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic Chapter 1 Mr. Wangler.
MIS 3200 – Unit 6.2 Learning Objectives How to move data between pages – Using Query Strings How to control errors on web pages – Using Try-catch.
Hello World In C++ and Microsoft Visual C++. Directions to begin a project 1. Go to All Programs 2. Open Visual Studio C++ 3. Click on New Project 4.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
Chapter 3: Using GUI Objects and the Visual Studio IDE.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
Introduction to Visual Basic.NET Chapter 2 Introduction to Controls, Events.
Introduction to Visual Basic.NET Your First Visual Basic.NET Application.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
Copyright © Curt Hill First Window Builder Program Easy GUIs in Eclipse.
Lecture 6: Introduction to Graphical User Interfaces (GUIs)
Visual Basic.NET BASICS Lesson 3 Events and Code.
OBJECTIVES: To open an existing Project called HelloWorld. To learn how set properties using the property window and how to set them in the code. Chapter.
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.
3.2 VB.NET Events An Event Procedure Properties and Event Procedures of the Form Tab Order of Controls Exercises.
Vocabulary in VB So Far. Assignment: Used to change the value of an object at run time Used to change the value of an object at run time.
MS Visual Basic 6 Walter Milner. VB 6 0 Introduction –background to VB, A hello World program 1 Core language 1 –Projects, data types, variables, forms,
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
SEEM3460 Tutorial GUI in Java. Some Basic GUI Terms Component (Control in some languages) the basic GUI unit something visible something that user can.
1 Advanced Computer Programming Lab Calculator Project.
Chapter 3 - VB.NET by Schneider1 Chapter 3 – Fundamentals of Programming in VB.NET Part I VB.NET Controls VB.NET Events.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 5.1 Test-Driving the Inventory Application.
You should unzip and download the beginning programs.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
Microsoft Visual Basic 2005 BASICS Lesson 3 Events and Code.
1 CS 106 Computing Fundamentals II Chapter 210 “Adding Controls to User Forms” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
Lecture Set 7 Procedures and Event Handlers Part B - The Structure of an Application Event Handlers.
Microsoft Visual Basic 2012 CHAPTER FIVE Decision Structures.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Using Forms and Form Elements In Visual Basic.NET.
Chapter 8 Multiple Forms, Modules, and Menus. Introduction This chapter demonstrates how to: – Add multiple forms to a project – Create a module to hold.
Visual Basic Fundamental Concepts
Visual Basic.NET Windows Programming
Chapter 9 Programming Based on Events
Computing with C# and the .NET Framework
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming UTPA – Fall 2012 This set of slides is revised from lecture.
Chapter 2 Visual Basic Interface
Variables and Arithmetic Operations
Visual Basic..
The University of Texas – Pan American
Chapter 3: Introduction to Problem Solving and Control Statements
Visual programming Chapter 2: Events and Event Handling
Visual Basic: Week 5 Review User defined functions
Visual C# - GUI and controls - 1
BASIC 17 Mr. Husch.
Introduction to Visual Basic 2010
Presentation transcript:

Intro to More Controls in C#

C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton – Picturebox – Group box Tab order Tooltips

Events GUI applications are generally event-driven. – The application waits until some event occurs, and then executes some code to handle the event. – Typical user-initiated events Pressing a key Clicking the mouse – C# handle events by creating a method. A method is a grouping of code that performs a common task – We’ll start by creating button click events

Creating an Event Handler Double-click the control in the design view to bring up the most common event for that control Select the control in the design view, then click on the lightning bolt in the properties window to find the event you’re interested in for the selected control

Event Example For example, creating a button and then double- clicking it results in the following event handler: For now, don’t worry about the object sender, EventArgs e part. For now all you really need to know is that any code you enter between the curly braces will be executed when the button is clicked.

Event handler experimentation Try adding some code to change the properties of other controls on the form There are assignment statements that copy the value on the right into the object on the left (not the same as mathematical equality) Every statement ends in a semicolon

Methods In our code we can also invoke methods associated with some object – Methods have ()’s at the end; later we will put things inside the parenthesis textBox1.Clear(); textBox1.Text = ""; Method to clear the textbox Manually set the textbox to a blank Both do the same thing

String concatenation Text enclosed in "" are called strings We can concatenate (or glue together) two strings with the + symbol What will this do? textBox1.Text = textBox1.Text + " HELLO "; textBox2.Text = txtName.Text + " is your name ";

Comments Commenting helps explain how your code works Commenting can be used to disable code without deleting it if you want it back later // – Everything from // to the end of the line is ignored /* */ – Everything in between the /* and */ is ignored Can use these buttons on selected text // textBox1.Text = " HELLO "; /* textBox1.Text = " HELLO "; */