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.

Slides:



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

About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
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.
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
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.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
A First Program Using C#
CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Basic
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.
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
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,
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.
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall
Lecture Set 1 Part C: Understanding Visual Studio and.NET – Applications, Solutions, Projects (no longer used – embedded in Lecture Set 2A)
CSCI 3328 Object Oriented Programming in C# Chapter 1: Introduction to C# Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
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.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
CS590VC – Tutorial 6 Client-side connection through external application.
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.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
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.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
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.
C# Diline Giriş.
Introduction to Visual Basic. NET,. NET Framework and Visual Studio
Dive Into® Visual Basic 2010 Express
Visual Basic Fundamental Concepts
Visual Basic.NET Windows Programming
Chapter 2: The Visual Studio .NET Development Environment
Introduction to Programming and Visual Basic
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.
Introduction to Visual Basic 2008 Programming
Chapter 2 – Introduction to the Visual Studio .NET IDE
3.01 Apply Controls Associated With Visual Studio Form
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
Week 1 Gates Introduction to Information Technology cosc 010 Week 1 Gates
Introduction to C# AKEEL AHMED.
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Visual Basic..
Chapter 2 – Introduction to the Visual Studio .NET IDE
Hands-on Introduction to Visual Basic .NET
The University of Texas – Pan American
CIS16 Application Development Programming with Visual Basic
How to Run a Java Program
CIS16 Application Development – Programming with Visual Basic
Welcome to Intro to C/C++ CISC 192
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.
CSCI 3327 Visual Basic Review: Exam I
Welcome to Intro to C/C++ CISC 192
IS 135 Business Programming
CSCI 3328 Object Oriented Programming in C# Review: Exam I
Presentation transcript:

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. John Abraham. -- Xiang Lian

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#

Background Required Thorough 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 (example, look up syntax)

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

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

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

Versions of C# You can program using 2008 or 2010 Our book only covers 2008 Usually it takes a year or so for new books to come out If you use 2010, you have to find help from other sources or the Web

The Time for Class 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

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)

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

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.

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.

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

Object Technology in 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

.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

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

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

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

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

To Get .Net Namespace Documentation Visit: http://msdn.microsoft.com/en-us/library/ms229335.aspx

How Do You Write and Run a Program? Use visual studio to create a 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. Start 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.

Options for a New Project Console application Windows forms application …

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(); }

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. If 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

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

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.

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

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.