AllTheTimeWorld.com

csharp codeWriting Code in C#

Writing Code in C#

Learn C# (C sharp) in FREE step-by-step lessons.

Writing Code in C#

Writing code in C#, Change Properties, A console app

We have learned to change properties at design time.

In this lesson we will learn to write code.

In C# we will write code to execute when an event occurs:

Sometimes we will use the code to change properties of the form or the controls.
For instance we want to change the backcolor of the form when the user clicks BtnRed.
We may want to hide a control under certain circumstances.

The possibilities are endless! Let's get started!

In order to do this you will:

Please study the material at each of the links below.

  1. Microsoft Reference Microsoft Reference: C# Coding Standards

  2. Writing Code to change properties of the form Writing Code to change properties of the form: Instead of changing properties in the design view,
    it can be done with code.
    /csharp/videos/csharp-code.mp4
  3. Comments: Comments are notes a programmer makes about the code

  4. Code created Code created: An explanation of each line of code
    /csharp/videos/csharp-code2.mp4
  5. Adding events for controls Adding events for controls: Some events can be added by double clicking on the control
    /csharp/videos/csharp-events.mp4
  6. Adding items to listbox at runtime Adding items to listbox at runtime: Clicking a button adds the conents of a text box to a list box.
    /csharp/videos/csharp-listbox.mp4
  7. Changing the location of a control Changing the location of a control: The location is a Point with x and y values
    /csharp/videos/csharp-location.mp4
  8. Mouse Move Event, Arguments Mouse Move Event, Arguments: The mousemove event has argument e that has the location
    /csharp/videos/csharp-mousemove.mp4
  9. Using the TextBox Control Using the TextBox Control: After user types their name and presses a button,
    a greeting is displayed
    /csharp/videos/csharp-textbox.mp4
  10. Using the Scroll Bar Control Using the Scroll Bar Control: A scrollbar is used to select inches
    /csharp/videos/csharp-inches.mp4
  11. Debugging Tools Debugging Tools: A few tools for debugging are shown
    /csharp/videos/csharp-debug.mp4
  12. Creating a Console App Creating a Console App: A console app runs in the system window instead of a form
    /csharp/videos/csharp-console.mp4