Lab #2 (Introduction to C# and windows Form Applications)



Similar documents
MS Visual C++ Introduction. Quick Introduction. A1 Visual C++

Windows Presentation Foundation (WPF) User Interfaces

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

Microsoft Visual Studio 2010 Instructions For C Programs

DATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan

Introduction to Java

1. Create SQL Database in Visual Studio

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Lab Experience 17. Programming Language Translation

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011

First Bytes Programming Lab 2

Course MS10975A Introduction to Programming. Length: 5 Days

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS170 Lab 11 Abstract Data Types & Objects

Visual Logic Instructions and Assignments

Topic 11 Scanner object, conditional execution

Appendix K Introduction to Microsoft Visual C++ 6.0

Windows Presentation Foundation Tutorial 1

Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game

ADP Workforce Now V3.0

Designing a Graphical User Interface

Visual Basic 2010 Essentials

How To Develop A Mobile Application On Sybase Unwired Platform

Visual Studio 2008 Express Editions

William Paterson University Department of Computer Science. Microsoft Visual C++.NET Tutorial Spring 2006 Release 1.0

Visual Basic Programming. An Introduction

JAVA - METHODS. Method definition consists of a method header and a method body. The same is shown below:

INTRODUCTION TO C# 0 C# is a multi-paradigm programming language which is based on objectoriented and component-oriented programming disciplines.

2009 Tutorial (DB4O and Visual Studio 2008 Express)

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Introduction to ASP.NET Web Development Instructor: Frank Stepanski

Introduction to the use of the environment of Microsoft Visual Studio 2008

Konzepte objektorientierter Programmierung

Introduction to Object-Oriented Programming

SQL Desktop Application For WebService in C# dr inż. Tomasz Tatoń

Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer

How to start creating a VoIP solution with Ozeki VoIP SIP SDK

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4

netduino Getting Started

Building Java Programs

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

System.out.println("\nEnter Product Number 1-5 (0 to stop and view summary) :

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Deitel Dive-Into Series: Dive Into Microsoft Visual C++ 6

A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION

Building Java Programs

Moving from CS 61A Scheme to CS 61B Java

Using C# for Graphics and GUIs Handout #2

CS 106 Introduction to Computer Science I

Introduction to Building Windows Store Apps with Windows Azure Mobile Services

EFORMS MANUAL FOR SHAREPOINT ONLINE

ACP ThinManager Tech Notes ThinManager and PXE Boot

A SharePoint Developer Introduction

Changing the Display Frequency During Scanning Within an ImageControls 3 Application

Using Visual C++ and Pelles C

Building cross-platform mobile apps with Xamarin

Program to solve first and second degree equations

This loop prints out the numbers from 1 through 10 on separate lines. How does it work? Output:

IS0020 Program Design and Software Tools Midterm, Feb 24, Instruction

Getting Started with Telerik Data Access. Contents

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

What's New in ADP Reporting?

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Chapter 2: Elements of Java

Lecture 5: Java Fundamentals III

Chapter 2 Introduction to Java programming

Sales Person Commission

Kentico CMS 5 Developer Training Syllabus

Programming with the Dev C++ IDE

Lab 9 Access PreLab Copy the prelab folder, Lab09 PreLab9_Access_intro

1. a procedure that you perform frequently. 2. Create a command. 3. Create a new. 4. Create custom for Excel.

When a variable is assigned as a Process Initialization variable its value is provided at the beginning of the process.

Tutorial Build a simple IBM Rational Publishing Engine (RPE) template for IBM Rational DOORS

Sample CSE8A midterm Multiple Choice (circle one)

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

CSE 1020 Introduction to Computer Science I A sample nal exam

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

McGraw-Hill The McGraw-Hill Companies, Inc.,

CHAPTER 10: WEB SERVICES

Programming Languages CIS 443

OBJECTIVE1: Understanding Windows Forms Applications

C Compiler Targeting the Java Virtual Machine

Understanding In and Out of XAML in WPF

Chapter 1 Java Program Design and Development

Chulalongkorn University International School of Engineering Department of Computer Engineering Computer Programming Lab.

Hands-On Lab. Microsoft Office Programmability in C# and Visual Basic. Lab version: 1.0.0

Managing Contacts in Outlook

HOUR 3 Creating Our First ASP.NET Web Page

CS 111 Classes I 1. Software Organization View to this point:

View Your Photos. What you ll need: A folder of digital photos Jasc Paint Shop Photo Album 5

Semantic Analysis: Types and Type Checking

Boogie: A Modular Reusable Verifier for Object-Oriented Programs

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

Quick Start Guide. Microsoft Publisher 2013 looks different from previous versions, so we created this guide to help you minimize the learning curve.

Transcription:

Lab #2 (Introduction to C# and windows Form Applications) In this the following goals will be achieved: 1. C# programming language is introduced 2. Creating C# console application using visual studio 2008 3. Creating windows forms application using visual studio 2008 Introduction C# (programming language) (pronounced as see sharp) is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, procedural, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft within its.net initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006). C is one of the programming languages designed for the Common Language Infrastructure. C is built on the syntax and semantics of C++, allowing C programmers to take advantage of.net and the common language runtime. C is intended to be a simple, modern, general-purpose, object-oriented programming language.[6] Its development team is led by Anders Hejlsberg. The most recent version is C 5.0, which was released on August 15, 2012. Creating C# console application using visual studio 2008 To do this follow the following steps: 1. Open Microsoft visual studio 2008 application 2. File > New Project > Visual C# > Windows > Console application > and write down the project name.

3. You will find the following screen 4. The project tree is on the right side of your screen, your application starting point is Program.cs which you could consider holding the main function as in your c++ project. 5. Try writing the following code snippet Console.Out.WriteLine("Hello World this is test 1"); And run them by pressing ctrl+f5 6. Try more code loop for example int i = 0; for (i = 0; i < 11; i++ ) { if (i == 5) { Console.Out.WriteLine("Reached the middle value"); else { Console.Out.WriteLine("I value is: " + i); 7. Next we will create a class called Calculate and instantiate a new object from it and run it by doing the following: a. Right click on the project name > add > class, now write down the class name. b. The class is now created write the following snippet code in the class body public static double add(double num1, double num2) { return num1 + num2; 8. Now return to program.cs and write the following code in order to test the class we have just created Console.Out.WriteLine("calc add test: " + Calculate.add(10.5, 36.7)); 9. String is very powerful object and we will use it later a lot you can create strings and convert them to integers by as the following snippet string number = "100"; int num_value = Int32.Parse(number); num_value++; Console.Out.WriteLine("Number value is: " + num_value);

Creating windows forms application using visual studio 2008 To do this follow the following steps: 1. Open Microsoft visual studio 2008 application 2. File > New Project > Visual C# > Windows > Windows Forms Application> and write down the project name. 3. The project tree is on the right side of your screen, your application starting point is Program.cs which you could consider holding the main function as in your c++ project. 4. You will find a file created called Form1 and it represent the Form UI appearing in your left side of screen. 5. The first form which will appear to you on running is Form1 6. To add more forms right click on your project > Add > Windows Form and write down the form name. 7. To change the first form to appear go to program.cs and change Form1 in this line Application.Run(new Form1()); to your desired form name. 8. First task to implement is to create a form containing welcome text do this by following these steps: a. Click on toolbox drag Label and release on your form b. c. Click on the label and change its text from the properties window appearing

d. Try running now by pressing ctrl+f5 9. Next task is to add a button and control its clicking action to display a message box by doing the following: a. Click on toolbox drag Button and release on your form b. Click on the button and change its text from the properties window appearing c. Now double click the button and the following window will appear

d. Write the following code snippet in order to show the message box String message = "This is My firsr app"; MessageBox.Show(message); e. Run now and test it 10. We now want to navigate from a form to another form do this by the following steps: a. Create a button like the previous task b. Write the following code snippet in order to show the next form // creating object of the new form Form1 f1 = new Form1(); // hiding the current form this.hide(); //showing the created form f1.show();. c. Run now and test it.. 11. Next task will be passing a parameter from a form and displaying it on the other do this by the following steps: a. Go to the first form and drag a TextBox component on it as well as a new button b. Go to the second form and create a Label on it c. Go to the second form cs file and add the following function to its code public void set_text(string text){ this.label1.text = text; d. Go to the first form double click the button used for navigation and write the following snippet code // // creating object of the second form Form1 f1 = new Form1(); this.hide(); // getting textfield text string message = this.textfield1.text; // setting the text in next form label f1.set_text(text);

f1.show(); 12. Final task will be creating a button on your final form of navigation to safely close the application by the following steps: a. Creating a button on your final form as in step 11 and write down the following snippet as its action Application.Exit(); Now you have finished learning an introductory lesson about C# by creating two types of projects console, and Windows Forms apps.