19 December 2018

c#basics Whastapp ListBox KeyPress KeyDown Leave DateTime.Now KeyValue

We built a chat Application (like Whatsapp, is typing …)
We learned how to add ListBox and more events into our WinForm application.

More topics covered:

  • ListBox (Add item, get count, set focus)
  • KeyPress event: whenever the user clicked on keyboard inside TextBox
  • KeyDown: here we can detect ENTER key [KeyValue == 13]
  • Leave: whenever the user left the TextBox
  • How to print the current Date-Time
  • How to convert Integer into String , i.e. x.ToString()

Links:

12 December 2018

c#basics Calculator Button TextBox Click-Event Debug.WriteLine

We built our first calculator in Windows Form Application
We learned how to add buttons and click events into our WinForm application.

More topics covered:

  • Text boxes
  • Add Debug messages (to output window)
  • Rename the components in the window (i.e. button, text box etc.)
  • Insert text into Label
  • Add our own function into our WinForm code

Links:

09 December 2018

c#basics Functions advanced, WinForm application, String, boolean

We learned the String and Boolean types and some basic usage.

We saw functions advanced features:
(See C# 5.0 IN A NUTSHELL: page 42)
– Arrays as parameter
– int (primitive) as parameter
– ref
– out
– default values
– params
– destructuring parameters

We created our first Window Forms application
– Hello world!
– Colored in Green 🙂

Links:

05 December 2018

c#basics Functions, Memory Game, WriteLine($), C# website

Cool site to run c# code from the web: https://dotnetfiddle.net/

We learn how to use Console.WriteLine with $. for example:
int x = 10;
Console.WriteLine($”x is equal to : {x}”)

Memory Game project – due date 19/12/2018!

Functions:
– Use to module our code , and re-use the code
– Used with input parameters
– Used with return value

28 November 2018

c#basics Arrays, code snippets

Introduction to Arrays: array is a storage for many elements in a same collection. i.e. list of 100 grades for a class
Array types:
– single dimension []
matrix[,]
jagged[][]

Initialize an array: i.e. array of 10 integers:
int[] grades = new int[10];

Get the array length: grades.length

for loop on the array:
for(int i = 0; i < grades.length; i++) { … }

Code Snippets:
Code snippets are used to paste code into the visual studio with a keyboard shortcut. i.e. “cw” + tab + tab write Console.WriteLine()
So, we can make our on shortcuts. In class we made an example of making a keyboard shortcut “ccr” which pastes:
Convert.ToInt32(Console.ReadLine());
see the video…

21 November 2018

c#basics do-while, continue, break, prime numbers

Topics:
– Learning do-while: same as while except that a first iteration will always occur!
– continue-break out of loops:
continue: will skip to the next iteration
break: will exit the loop
– checking if a number is a prime number or not: run from 2 to number-1 and look for a divider which returns module of zero

14 November 2018

c#basics functions, random, switch-case, GITHUB

Introduction to:
– writing our own functions: code inside a named paragraph
– generating Random numbers: using Random class
– switch-case: ease the long if-else
– building our first card GAME
– introduction to GITHUB repository: FREE cloud storage for our code!

11 November 2018

c#basics for loop, nested for, calculator, if-else-if

introduction to new concepts:
– for loop: used to iterate over a predefined range of numbers
– nested for: for inside a for
– if else else-if: use a condition on a negative flow
– building our first calculator

 

07 November 2018

c#basics if, while, WriteLine, ReadLine, Convert.ToInt32

C# program with more topics:
– if: condition
– if else: condition and false result
– while loop
– WriteLine to the screen
– ReadLine: reads the user input from the keyboard
– Convert.ToInt32: converts a text to an integer (since ReadLine returns a string)

Design a site like this with WordPress.com
Get started