CSCI 3328 Object Oriented Programming in C# Chapter 1: Introduction to C# Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539

Slides:



Advertisements
Similar presentations
Programming Dr. Abraham Most slides are from your textbook.
Advertisements

Compunet Corporation Programming with Visual Basic.NET GUI Week # 11 Tariq Ibn Aziz.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Copyright © 2012 Pearson Education, Inc. Chapter 2 Introduction to Visual C#
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Tahir Nawaz Visual Programming C# Week 2. What is C#? C# (pronounced "C sharp") is an object- oriented language that is used to build applications for.
Introduction to Programming and Visual Basic
Object Oriented Software Development 1. Introduction to C# and Visual Studio.
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
A First Program Using C#
Visual Basic Chapter 1 Mr. Wangler.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Basic
Neal Stublen Overview of.NET Windows Applications Microsoft Windows OS / Intel Platform Windows Application File SystemNetworkDisplay.
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.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Intro to C# Dr. John P. Abraham UTPA. Background required Thorough C++ programming – If you made an A in 1370/1170 you will do fine with some effort.
Module 1: Introduction to C# Module 2: Variables and Data Types
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Microsoft Visual Basic 2005: Reloaded Second Edition
Introduction to .NET Framework
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Neal Stublen Class Objectives  Develop an understanding of the.NET Framework  Gain proficiency using Visual Studio  Begin learning.
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
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,
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 1: Introduction to Python Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Intro to C++. Getting Started with Microsoft Visual Studios Open Microsoft Visual Studios 2010 Click on file Click on New Project Choose Visual C++ on.
Lecture 1 Programming in C# Introducing C# Writing a C# Program.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Programming in C#. I. Introduction C# (or C-Sharp) is a programming language. C# is used to write software that runs on the.NET Framework. Although C#
Week 1: THE C# LANGUAGE Chapter 1: Variables and Expressions ➤ Included in Visual Studio.NET ➤ What the.NET Framework is and what it contains ➤ How.NET.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Visual C++ Programming: Concepts and Projects
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
CSCI 3327 Visual Basic Chapter 3: Classes and Objects UTPA – Fall 2011.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Intro to dot Net Dr. John Abraham UTPA CSCI 3327.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Object-Oriented Application Development Using VB.NET 1 Chapter 2 The Visual Studio.NET Development Environment.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Chapter 2: The Visual Studio .NET Development Environment
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.
CSCI 3328 Object Oriented Programming in C# Chapter 1: Introduction to C# UTPA – Fall 2012 This set of slides is revised from lecture slides of Prof.
The University of Texas – Pan American
CIS16 Application Development Programming with Visual Basic
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall 2012 This set of slides is revised from lecture.
IS 135 Business Programming
Presentation transcript:

CSCI 3328 Object Oriented Programming in C# Chapter 1: Introduction to C# Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX

Objectives In this chapter, you will – Know requirements of this course – Recall basic components in a computer system – Learn the evolution of programming language – Refresh your memory about the object-oriented programming – Become aware of the.Net Framework for Visual C# 2

Background Required C++ Programming – If you made an A in 1370/1170 you will do fine with some effort – If you have already taken 2380, you will find this course not very difficult You need to be able to look up how to get things done (for example, look up syntax) 3

Programming, Programming, Programming This class is unlike other courses in that you will spend a lot of time doing actual programming You should never copy a program from someone else Even if your program does not perform as good as someone else’s, you should submit what you have You should not hesitate to ask questions in class 4

Assignments Unless I announce it, programs are due in one week after assignment is given in class, or posted Occasionally, I will give two weeks for difficult programs You should work on a program the same day it is assigned That way you can ask questions during the following class period 5

Use of the Textbook I will not be covering chapter by chapter I will cover important points needed to complete the assignments You need to search the index in the back to find the topic needed for each assignment You can also obtain help from MSDN at the Microsoft site 6

Versions of Visual C# You can program using VC# 2008, 2010, or 2012 Our book only covers 2008 – If you use 2010 or 2012, you may need to find help from other sources or the Web – Usually, there are not many differences for programming with a higher version of Visual C# 7

The Time for Class 8 I expect to hold the class for little over an hour each time Remaining time should be spend with your assigned groups to discuss the project in class Please do not exchange programs with each other, just ideas

9

CSCI 1380: Elements of a Computer System Hardware – CPU – Main memory – Secondary storage – Input / Output devices Software – System programs – Application programs (e.g. Visual Studio) 10

Programming Languages Machine language Assembly language High-level language – E.g., C# 11

Object Technology We humans are very good in recognizing and working with objects, such as a pen, a dog, or a human being We learned to categorize them in such a way that make sense to us. – We may categorize them as animate object, inanimate objects, pets, friends, etc. 12

Object Technology (cont'd) We some times classify objects based on their attributes, for example, green apples or red apples, fat or slim people, etc. If you think about it each object has many attributes. – If I ask you list the attributes of an orange, you probably could list many things such as color, shape, weight, smell, etc. 13

Object Technology (cont'd) In addition to attributes, all objects exhibit behaviors. A dog eats, barks, wags its tail, plays, and begs. – A dog exhibits many more other behaviors than this short list. Another thing we need to remember about objects is that objects interact between each other 14

Object Technology in Visual C# Visual C# – Object-oriented E.g. forms, labels, buttons, radios, checkboxes, etc. – Properties of objects E.g. background color of forms – Event-driven Behaviors  events of objects E.g. clicks 15

.Net Framework A software platform Language-neutral Designed for cross-language compatibility – Applications written in C# may reference a DLL file written in any other language 2 components: – Common Language Runtime (CLR) – Class Libraries 16

The.Net Framework Underneath the applications you develop using C# is the.Net Framework containing a library of classes needed for windows forms and web forms. The.Net framework interacts with the Common Language Runtime (CLR), which in turn interacts with the operating system and the hardware This way programs you write using C# can run on different operating systems and hardware platforms as long as it has the correct version of the.Net installed on it 17

Common Language Runtime Execution Engine of.Net Manages the execution of programs and provides core services: – Code compilation – Memory allocation – Thread management – Garbage collection 18

Class Libraries Designed to integrate with the common language runtime This library gives the program access to runtime environment The class library consists of lots of prewritten code that all the applications created in VC#.Net and Visual Studio.Net will use The code in Visual C # for all the elements like forms, and controls actually comes from the class library 19

Namespaces Within the.Net Framework, related classes are grouped into Namespaces You need to insert a “using AppropriateNamespace” in your program After that you can refer to methods and attributes of classes contained therein 20

To Get.Net Namespace Documentation Visit: 21

How Do You Write and Run a Program? Use the Visual Studio to create a project File  New  Project… The project file will have the extension *.csproj. The project stores all related files, including the source file you write. Every project has a solution file with the extension *.sln. You would be opening this file when you want to return to your program you were writing. This will open all associated files. The associated files may be contained in a subdirectory. After writing the source code, go to Build and build your solution, which creates the intermediate code Go to Debug and start without debugging The program run will finish and give you a prompt to press any key to continue. Starting with debugging, it will complete the run and return to you to the IDE. If your IDE does offer “without debugging”, add a Console.ReadKey() statement. 22

Options for a New Project Console application Windows forms application … 23

Hello Program using System; //using System.Collections.Generic; //using System.Linq; //using System.Text; namespace sayHello { class sayHello { static void Main(string[] args) { Console.WriteLine("Hello!"); Console.WriteLine("Welcome to Dr. Lian's C# Class!"); Console.ReadLine(); } 24

Using the Form Designer You can size the form by holding the handles in the corners or the middle Controls and other items are added to the form using the toolbox The control or item has properties that can be set To write the code for an event, you can click on the view code button above the solution explorer or by simply clicking on a button or anything else on the form Files with code you write will have extension.cs Files ending with designer.cs are code files generated by Visual Studio 25

Naming Controls and Boxes Use a convention you will remember You can start all button names with btn An accept button will be named btnAccept An exit button will be named btnExit All text boxes will start with txt Sales amount will be named txtSalesAmount All labels with start with lbl lblEnterName It is up to you to choose naming conventions you will recognize 26

Your First Assignment Assignment #1 The purpose of this assignment is to practice reading and writing to console using C#. It is a simple assignment. Use the following program run to design and write your program. Please submit Program listing and a screen capture of the program run. Follow the textbook examples to add comments as documentation. 27

Assignment Submission Make sure to include your name, assignment number, date due and date completed on each assignment you submit Assignment should be submitted in a manila folder with your name and assignment number appearing on the tab Submit your assignments to the Blackboard 28

Exercises Give a brief explanation of the.NET framework What is the Common Language Runtime? How do you place “Total Square Feet: 1238” in a text box? Assume that 1238 in an integer stored in a variable called sqFt. 29