1 / 56

About C# BY: MARK ANTHONY P. CEZAR

About C# BY: MARK ANTHONY P. CEZAR. C# C Sharp New Language introduced by Microsoft Goal is to provide ease of working, flexibility, and power of the Java and C++ languages. Fully Object Oriented PL Allows Programmer to develop applications Under windows and web browser.

layne
Download Presentation

About C# BY: MARK ANTHONY P. CEZAR

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. About C# BY: MARK ANTHONY P. CEZAR

  2. C# • C Sharp • New Language introduced by Microsoft • Goal is to provide ease of working, flexibility, and power of the Java and C++ languages. • Fully Object Oriented PL • Allows Programmer to develop applications Under windows and web browser

  3. Research History 1 Yellow Pad

  4. Installation .NET Framework v 3.5 Visual Studio Visual C# (2008,2010,2011) MSDN – Microsoft Developers Network(optional)

  5. Terminologies Objects as a thing . Examples of objects are forms and controls Properties tell something about object behavior such as names , color, size or location Methods action associated with objects are called method. Typical methods are Close, Show and Clear.

  6. Events write methods that execute when a particular Events occurs. An event occurs when the user takes an action such as clicking a button. Classes Contain definition of all available properties, Methods and events. It is a template or blueprint used to create a new object.

  7. GOOD PROGRAMMING 3 Steps for Planning and for developing the project. Planning Programming • Design the user interface 1. Define the user interface • Plan the properties 2. Set the Properties • Plan the c# code 3. Write the code

  8. IDE MAIN WINDOW • Visual Studio Environment and its various child window. • IDE main window holds VS menu bar, toolbars, display or hide Windows from the view menu

  9. IDE MAIN WINDOW Consists of: Toolbars each button represents a command that can be selected from a menu. Document Window the largest window in the center of the screen. The items that display in the document window include the Form designer, code editor, project designer, database designer And object browser.

  10. The Form Designer is where you design a form that makes up your user interface. The Solution Explorer Window holds the filenames for the files included in your project and list of the classes It references. The Properties Window set properties for the objects in Your project. The Toolbox holds the tools you use to place controls on a form.

  11. Three distinct modes are: Design time Run time Debug time

  12. Writing Your First C# Project • Select Visual C# / Windows / Windows Form Application / Enter name Hello world for the name of The new project. Note: Customizing windows, floating and docking

  13. Plan the Sketch of the Hello World form • Define user interface and place of the controls on the form. • Set the name , properties of the object and form. • Write codes The comment statement and hello world–Examples textBox1.Text = "hello world"; //Assign the message to the Text property.

  14. The Assignment Statement –General Form Object.Property – Value Ending a program by executing a Method Object.Method() Examples: helloButton.Hide(); messageLabel.Show(); this.Close();

  15. Syntax Errors • Breaking rules in punctuation, format or spelling. Run Time Errors • Project halts during execution • C# display dialog box and highlight statement causing the Problem. Logic Errors • Program runs but produces in correct results. • Beginners in programming often overlook their logic errors.

  16. Design a layout of a program for the great body gym center to display promotions. Put statement Label for each buttons of the following department. Hands on Programming 1 Great Body gym Membership Maintenance soup Equipment and Accessories Clothing Instructor Exit Programmed by <Your Name>

  17. Hands on Programming 2 Design any program that will use the following objects: 2 Text Box 4 Label Box 1 Picture 4 Radio Buttons 3 Button 4 Check Box ex

  18. Hands on Programming 3 This neighborhood store is an independently owned rental business. The owners would like to allow their customer to user the computer to look up aisle number for movies by category. Create a form with a button for each category. When the user clicks on a button, display the corresponding aisle number in a label. Include a button to exit. Include a button that holds your name at the bottom of the form and change the title bar of the form to Generation X Cinema. You may change font properties of the labels and size of your choice.

  19. Clearing Text Boxes and Labels. • Display a Photo upon selection • Disabling Controls • Setting Properties • Changing the color of text • Using radio buttons for selecting colors • Concatenating Text • Printing a Form

  20. Data – Variable and Constant • Memory locations that hold data that can be changed during project execution are variables. • Locations that hold data that cannot change during execution are called constants.

  21. Naming Rules • Consist of letters, digits and underscores • Begin with letter or underscore • Must not contain of spaces or period • Not a reserve word or keywords

  22. Naming Conventions • Identifier must be meaningful • Begin with a lowercase letter and capitalize each successive word of the name. Sample Identifiers Field of Data Possible Identifier Social security number socialSecurityNumberString Pay rate payRateDecimal Tax rate(constant) TAX_RATE_Decimal Population populationLong

  23. Quiz Indicate whether each of the following identifiers conforms to the rules of c# and to the naming convention. If the identifier is invalid ,give the reason. 0. omitted 6. subString • #SoldInteger 7. Text • Number Sold Integer 8. maximum • Number.Sold.Integer 9. minimumRate • Amount$Decimal 10. maximumCheckDecimal • Class 11. companyNameString

  24. ANSWER 0. omitted does not have a suffix indicate data type • #SoldInteger cannot contain character such as # • Number Sold Integer cannot contain blank spaces • Number.Sold.Integer period use only to separate item such Object.Property • Amount$Decimal cannot contain character such as $ • Class class is a reserve word • subString valid • Text reserve word • Maximum does not indicate clearly data type • minimumRate a suffix indicate data type used • maximumCheckDecimal valid • companyNameString valid

  25. Declaration statement example string customerNameString; string customerNameString = “None”; int totalSoldInteger = 0; float temperatureFloat; float temperatureFloat= 32f; decimal priceDecimal;

  26. Declaration statement example string customerNameString; string customerNametring = “None”; int totalSoldInteger = 0; float temperatureFloat; float temperatureFloat= 32f; decimal priceDecimal;

  27. The MessageBox Statement General Form MessageBox.Show(TextMessage, TitlebarText, MessageButtons, MessageIcon); MessageBox.Show(“Enter numeric data.”); MessageBox.Show(“Try Again.”, “Data Eror”); MessageBox.Show(“This is a message.””This is a title bar”, Messagebuttons.OK);

  28. Controlling Code Flow Comparison Operator – compare data and return either true or false result. It can be used to compare strings, numbers and even Booleans. comparison operator Meaning == is equal to != not equal to > greater than < Less than >= Greater than or equal to <= Less than or equal to

  29. Controlling Code Flow Logical Operators – combine comparison results and create compound expression. Operator Description && Returns a value of true if both values are true || Returns a value of true if either value is true ! Inverts the true or false result

More Related