GUI Programming in Visual Studio .NET

Slides:



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

CS0004: Introduction to Programming Visual Studio 2010 and Controls.
© 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,
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 1 Tariq Aziz and Kevin Jones.
Compunet Corporation Programming with Visual Studio.NET GUI Week 13 Tariq Aziz and Kevin Jones.
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 2 Tariq Aziz and Kevin Jones.
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.
Compunet Corporation Programming with Visual Basic.NET GUI Chapter 3 Week 13 Tariq Aziz and Kevin Jones.
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.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
Intro to MFC. Open VS and create new project 1)Open MS Visual Studio 2008 Professional (It must be the Professional Edition, the Express Edition will.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
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.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Project Deployment IT [211 CAP] How to convert your project to a full application.
BIL528 – Bilgisayar Programlama II Introduction 1.
Microsoft Visual Basic 2008 CHAPTER TWELVE Cell Phone Applications and Web Services.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Chapter 2 – Introduction to the Visual Studio .NET IDE
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
Chapter 3 - VB.NET by Schneider1 Chapter 3 – Fundamentals of Programming in VB.NET Part I VB.NET Controls VB.NET Events.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
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.
ALMAJMA'AH UNIVERSITY College of Science and Humanitarians Studies in Alghat Information Technology Section (211Tal course) 1.
Computing and Information Technology Building a Web Browser
Dive Into® Visual Basic 2010 Express
Chapter 3: I Need a Tour Guide (Introduction to Visual Basic 2012)
Visual Basic Fundamental Concepts
Chapter 1: An Introduction to Visual Basic .NET
Chapter 2: The Visual Studio .NET Development Environment
Chapter 1: An Introduction to Visual Basic 2015
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 – Introduction to the Visual Studio .NET IDE
GUI Programming using Windows Form
3.01 Apply Controls Associated With Visual Studio Form
Program and Graphical User Interface Design
Visual programming Chapter 1: Introduction
3.01 Apply Controls Associated With Visual Studio Form
Visual studio 2010 SENG 403, Tutorial 2 SENG Winter 2011.
Using Procedures and Exception Handling
Introduction to VB programming
Program and Graphical User Interface Design
Visual Basic..
Social Media And Global Computing Introduction to Visual Studio
Chapter 2 – Introduction to the Visual Studio .NET IDE
Windows Forms GUI: A Deeper Look
Understanding the Visual IDE
CIS16 Application Development Programming with Visual Basic
CIS16 Application Development and Programming using Visual Basic.net
Project Design, Forms and Buttons
CIS 338: Images on Forms Dr. Ralph D. Westfall May, 2009.
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

GUI Programming in Visual Studio .NET Chapter 2 Tariq Aziz and Kevin Jones Compunet Corporation

Properties of a GUI Object A GUI Object may have many properties. For example, a button object has a name, size, and location. The text property holds the string that is displayed in the button on the form. Suppose we want two buttons on our form: an OK button and a Quit button. After dragging two buttons from the toolbox to our form, we need to set the text property of each button, so that the following is true: Button1.Text = “OK” Button2.Text = “Quit” Notice that when we write code, we access the property of an object using dot notation; the name of the object comes first, then a dot, then the name of the property. Compunet Corporation

Setting GUI Object Properties We set the property of an object at design time using the Properties window. First, select the GUI object on your form (you’ll see selection handles appear around the object). The Properties window displays the properties of the currently selected object in the Windows Forms Design window. Simply scroll through the properties to find the one you want, then click on the value and change it. Note that setting the properties at design time determines the initial value of the properties at run-time. We may also change the values of properties at run-time by executing assignment statements, such as Button1.Text = "Push here" Compunet Corporation

Text Property of Button1 Object The “Text” property of the Button1 object is displayed here in the Properties window. Compunet Corporation

Text Property of Button1 Object Note that the Text property has been changed to “OK”, so Button1 now displays “OK” instead of “Button1”. Compunet Corporation

Lucky Seven program (Ch. 2) The Lucky Seven program from chapter 2 is a simple application that gives you practice in basic GUI programming. The program allows the user to click the Spin button, each time displaying three random numbers between 0 and 9. The user “wins” if any of the three numbers happens to be “7”, and he loses otherwise. First we’ll setup the user interface, then we’ll define the code behind the Spin button. Compunet Corporation

Start a New Visual Basic Project Click here to start a new project. Compunet Corporation

Name Your Visual Basic Project Type the name of your project here. A folder of the same name will be created to store your project files. Compunet Corporation

Starting With an Empty Form… Click on the Button Control in the Toolbox… Compunet Corporation

Draw a Button on Your Form… then click and drag to draw a button object on your form. Compunet Corporation

Button1… Here is your new button. Continue like this, adding another button and four labels. Compunet Corporation

Two Buttons, Four Labels Compunet Corporation

Editing Object Properties Now edit the text properties of each button and label so your form appears as follows… Compunet Corporation

Changed Text Properties… Compunet Corporation

Now Write the Code Double-click on the Spin button to warp to the Button1_Click event procedure, and fill in the code for the Spin button as it appears on page 53 in your book. You’ll need to go back and add the picturebox object to your form, though… Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles Button1.Click PictureBox1.Visible = False ' hide picture Label1.Text = CStr(Int(Rnd() * 10)) ' pick numbers Label2.Text = CStr(Int(Rnd() * 10)) Label3.Text = CStr(Int(Rnd() * 10)) ' if any caption is 7 display picture and beep If (Label1.Text = "7") Or (Label2.Text = "7") _ Or (Label3.Text = "7") Then PictureBox1.Visible = True Beep() End If End Sub Compunet Corporation

Type the code here… Type the code from page 53 in your book here. Compunet Corporation

Complete the Example from Chapter 2 Once you’ve finished typing all the code from the book, build and run your program as shown on the following slide. Compunet Corporation

Build the Lucky Seven Program To build (or compile) the program, select Build Solution from the Build menu. To run the program, select Start from the Debug menu, or simply click the Start (Play) button on the standard toolbar. Note: You must login as “student” (password = “computer”) to use this feature. Compunet Corporation

Your Program at Run-time! Compunet Corporation