Master C# in 6 hours With My C# Course | Kerem Aydin | Skillshare

Master C# in 6 hours With My C# Course

Kerem Aydin, Software Developer, Unity Developer, Gam

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
43 Lessons (5h 3m)
    • 1. C# Course Program

      5:15
    • 2. This is About Programming

      2:00
    • 3. C# .Net Framewrok

      2:56
    • 4. Development Enviroments

      6:34
    • 5. Install Visual Studio On Windows

      2:22
    • 6. Install Visual Studio On Mac

      3:33
    • 7. Introduction to Console

      0:46
    • 8. Write WriteLine

      4:58
    • 9. Console Read Readline

      3:15
    • 10. Variables

      9:18
    • 11. Variable Conversions

      8:13
    • 12. Windows Form

      1:28
    • 13. Neccessarry Windows

      7:51
    • 14. Form Element

      5:19
    • 15. Message Box

      5:14
    • 16. Button

      9:09
    • 17. 16 Label

      3:40
    • 18. Textbox

      6:29
    • 19. Group Box

      2:24
    • 20. Radio Button

      3:58
    • 21. Check Box

      3:58
    • 22. Combo Box

      9:21
    • 23. Datetime

      5:54
    • 24. Switch and Data Transfer Between Forms

      6:02
    • 25. Operators

      5:08
    • 26. Comments

      3:51
    • 27. Region

      2:02
    • 28. Naming Conventions

      4:21
    • 29. Break Points

      7:43
    • 30. Short Cuts

      3:37
    • 31. If Else

      12:55
    • 32. Switch Case

      6:22
    • 33. While Do While

      11:06
    • 34. For Loop

      5:33
    • 35. Jump Statements

      9:15
    • 36. Project

      20:57
    • 37. 36 Arrays

      9:44
    • 38. Methods

      16:38
    • 39. Class

      13:06
    • 40. List Class

      13:53
    • 41. Random Class

      9:08
    • 42. Timer Class

      7:29
    • 43. Math Class

      20:24
86 students are watching this class

About This Class

Hi there,

Welcome to C# in 6 Hours: C# For Complete Beginners Learn C# by Coding course

Do you want to learn C# but have no experience at all.  Our C# fundamentals for beginners course is the perfect place for you to start. In this course, we designed C# .NET (pronounced C- see  #-sharp) course to give you everything you need to become productive with C#.

Code with C# today!

Enroll and master fundamentals of C# and programming with .NET framework, because you'll have lots of options waiting in front of you. Either choose to build mobile apps or you can change job and work as a web developer. We want you to know that when you know the fundamentals well, switching to different technology stacks is easier.

That`s why you are at a great place to start with C#. 

All my students will have a chance to learn not only the whats but also learn the whys and hows.

What you will learn?

  • C# Programming and Features of C#

  • Visual Studio IDE

  • Console Application

  • Variables

  • Primitive Types and Non-Primitive Types

  • Flow Control Expressions

  • Arrays and Lists

  • Error Handling and Debugging

  • Functions

  • Reading File

  • Writing to File

  • DateTime

No prior knowledge is needed! 

It doesn't need any prior knowledge to learn it and the C# is easy to understand for the beginners. 

This course starts with very basics. First, you will learn how to install the tools, some terminology. Then the show will start and you will learn everything with hands-on practices.  I'll also teach you the best practices and shortcuts.

Step-by-Step Way, Simple and Easy With Exercises

By the end of the course, you’ll have a firm understanding of the C# language and valuable insights on how things work under the hood and you'll also be very confident in the basics of coding and game development, and hungry to learn more. The good news is since the Free and popular tools are used you don’t need to buy any tool or application.

Let`s get in the class

Transcripts

1. C# Course Program: Hello, dear friends. Welcome to our dot net training. Now, in this course, we're going to learn programming C sharp in the dot net framework and installing visual studio on Windows and Mac OS console applications. Variables necessary windows on visual studio toolbox elements. - Necessary information before coding like break points were comments if else statements switch case statement while do while loops for four each loops a raise, methods classes and using a blissed class Brandon timer in math class. So why don't we go ahead and get started learning? 2. This is About Programming: Hello, dear friends. So in this part, we're going to learn some information about programming. So just what is programming? Let me tell you, the programming is the process of teaching to the computer necessary solutions to solve a specific problem. So simply programming is the process of creating software. Now the computer is doing a program that's called a run process. Um, and it uses particular machine language, and there are many programming languages. And today we're going to examine three classes, low level programming languages, mid level programming languages and high level programming languages now low level programming languages. These are very close to the machine language because they're fast, they're still used in many areas, and we can give them any sorts of assembly language as an example, middle level programming languages. Our language is between the machine language and spoken language, and these air named middle level programming languages. For example, C Sharp C plus plus and 80 a are examples of middle level programming languages. Now, the high level programming languages are the programming languages that are closest to spoken language, and we call them high level programming languages, of course, but they include basic Pascal Cobell and these air some pretty good examples You may have heard of them. You may not have heard them, but these are indeed examples of high level programming languages. So during this training period, we're going to just work on C sharp. 3. C# .Net Framewrok: Hello, my dear friends, so C sharp. It's a middle level programming languages like I'm sure that you learn in the first part. Um, it was produced by Microsoft in 2000. If he can remember that far back, um, they basically combined C plus plus and visual basic to make C sharp. Now See Sharp has many common features with Java programming language. It's an object oriented programming language for one now in C. Sharp objects are already created as classes, and then users can use them to drag and drop objects as necessary or as desired, depending upon the design. So therefore, it is a very useful language to learn, and it's an alternative for beginners. However, we can produce many, many comprehensive projects with C. Sharp. Don't let the beginners label fool you, so let's see what we can do with C Sharp. We could make console applications, form applications, Web applications, mobile applications, more mobile applications, depending from where you from two D and even three D games, all kinds of stuff. What is dot net framework? All right, so you've heard me talk about it before. The dot net framework is, ah managed execution environment for Windows. Now it provides a variety of services to its running APS. It consists of two major components, which are the common language runtime, or CLR. And that's basically the execution engine that handles running APS and the dot Net Framework Class Library, which provides a library of tested reusable code. The developers can call from their own APS now here, a few very valid reasons for you to start programming with the help of dot net framework, reliability, performance, productivity, security, integration, deployment. Great. So in this training, we're going to be using C sharp and the dot net framework and the next parts of the training we're going to, I don't know, explore some of the advantages. Ah, when you use them together, the framework includes time class, math class and some other good things. In the next part, we're going to examine the development environments. See you in the next section 4. Development Enviroments: development environment so programmers can use development environments for coding right. The most popular development environments for C sharp and dot net frameworks are mano developed, sharp developed and visual studio mano develop. So Mono Develop is an open source integrated development environment for Lennox, Mac OS and Windows. Its primary focus is the development of projects that use mono and dot net frameworks. Now mano develop integrates features similar to those of Net beans and Microsoft Visual Studio, such as automatic code completion, which is very handy source control, graphical user interface. GeoEye and Web designer. So mono Develop integrates a G t k Sharp, D y designer called Aesthetic. It supports Boo See C plus plus C sharp F sharp Java oxygen, Vala, Java. Script Visual basic dot net so model developed can be used on Windows. Mac OS and Lennox says, I was telling you before the Modern developed has included within a C sharp compiler since its earliest versions that I can think of. In fact, trust me on that customized version of mono developed formally shipped with Windows and Mac versions of Unity Um, which is the game engine by Unity technologies. You probably played it whether or not you knew it or not, Um so it enabled advanced C sharp scripting, which was used to compile cross platform video games by the Unity compiler Sharp Developed So Sharp Develop. Also styled as sharp Develop is a free and open source integrated development environment or i d E for the dot net framework. Mono G, T K Sharp and Glade Sharp platforms. So it supports development in Boo C Sharp Visual basic dot net F sharp python, ruby Those air the primary programming languages it supports. It was designed as a free and lightweight alternative to Microsoft Visual Studio, and it contains an equivalent feature for almost every essential visual Studio Express feature, including features for project management, code editing, application, compiling and debugging. Now to allow for easy project migration, Sharp Developed works natively with visual studio project and code files. It's also able to compile applications for the dot net framework. Sharp Develop is written entirely in C Sharp and consists of about 20 components that integrate into the form of the application. Now the source code editor component is known as Avalon at it, and it could be used by other applications now early in its development, the project was split for mono and G D K sharp development into the model developed project . Microsoft Visual Studio. So Microsoft Visual Studio is an integrated development environment from Microsoft. It is used to develop computer programs as well as websites and Web, APS, Web services and mobile APS. Visual studio uses Microsoft software. Of course, it uses Mike Show software developed now it can. They can produce both native Code and managed code. Visual Studio includes a code editor supporting Intel, a Sense, which is a code completion component as well as code re factoring the Integrated de Bugger works both as a source level debugging and a machine level. The bugger. Other important building tools include a code profiler forms designer for building, GeoEye applications, Web designer class designer and a database schema designer. It accepts plug ins that enhanced the functionality at almost every level, including Outings Board for Source Control systems and adding new tool sets like editors and visual designers for domain specific languages or even tool sets for other aspects of software development. Lifecycle like the team foundation's server client, Team Explorer Visual Studio, supports 36 different programming languages and allows the code editor, Andy Bugger, to support nearly any programming language provided a language specific service exists, so some of the built in languages include see C Plus plus visual basic dot net. C. Sharp Have sharp Java script. XML html CSS Python, Ruby No Js The most basic addition of Visual Studio, which is a community edition that's available for free of charge. The slogan for visual studio community addition is free. Fully featured i D. E for students, open source and individual developers. How's that for a mantra? So the currently supported visual studio version is 2019 and in this training we will use Visual Studio 2019. So the next part we're going to install visual studio for Windows and Mac OS See you in the next section. 5. Install Visual Studio On Windows: my dear friends. So in this video we will install visual studio on Windows. So let's begin. So first, let's search visual studio click downloads. And of course, you can choose a version you want. We here will demonstrate how to choose community. And now run the downloaded file. Continue now wait while the installers downloading select dot net click install. And as you can see, visual studio will start right after installation. So now you can choose your theme and the insulation is completed. So now we can use visual studio Next video. We're going to install visual studio on Mac OS see in the next video. 6. Install Visual Studio On Mac: Hello, my dear friends. So in this video, we're going to install visual studio on Mac, So let's begin. So first, let's search visual studio click downloads. So to start for free, download Visual Studio Community 2019 for Mac. Of course, if you already have a visual studio, professional or visual studio enterprise subscription just down, though, the addition that matches your subscription and mount the downloaded disk image by double clicking it and just click install. To continue, - continue select dot net core Click Install and after the installation completes Click Start Visual studio for Mac to launch, Click on New Project and now visual studio is ready to use see in the next video. 7. Introduction to Console: Hello, my dear friends. In this video, we will examine the console applications. So let's begin. Console applications can be thought of as the first step in programming, so this type of application could be done in arithmetic operations. But usually these applications air used for introducing you to programming. So they're basically five basic commands used in console applications. And these are right. Right line read key. Really read line. So why don't we go ahead and examine in detail these commands? See you in the next section. 8. Write WriteLine: Hello, dear friends. So in this part, we're going to learn, right, right line and read key. So let's begin. So before getting into this topic, we really need to give a brief in introduction into the variable and the variable types just to make sure that we're on the same page. Of course, more detailed information about this subject can be found in the following sections. Now, in the framework of the data types allowed by the language that we use in programming, the structures that enable us to store data and information are called variables. So in other words, variables are data holders that will take the values that we enter or a sign some values to and, you know, by running the program. Now, each of these variables has different types that indicate which type of data it can hold. So the type of variable ah cannot be used without being defined. That makes sense. So for now, we're just gonna look at string and int string name and student number name equals John. Student number equals 12 or we can use like string name equals John, and student number equals 12. Okay, so for now, it's enough that we have to find these variables for the console applications. So the right and right line commands air used in console applications to ask questions or give information to the user. The use of these two particular commands is pretty much the same. But there are some differences. When the right command is used, the cursor stops at the end of the text. However, when you use the right line command, the cursor is located at the bottom line of the text. So usage of right and right line is like this. Okay, so when these codes air executed, we cannot see the cursors true place. Because when we press any key display, it will close so we can use the read key Command to see the next character. If you use the Reekie Command, you can press one key before the display is closed. And when we use this command, we can see where where the cursor is. Right? So this is how you use it. First will over in visual studio, click on new project. Choose C sharp from language, Jews console application. And now we can start coding console application. So we start to write this and the console will, right? Hello and click. Run! Now look here. See, We cannot see the cursor is true play. So the eric code zero in the display indicates that there are no errors in the program. We will use reading key Now, start and look at that. The cursor stops at the end of the text. So one more line. And as you can see, there's no space between words. So if you want to put a space, you can use the back slash t code. Now, run and look that there is a space between the helo and the what words. Now, if you want to start the next line, you can use back slash in and now we'll use right line. And what do you see here? The cursor is located at the bottom line of the text. One more line. So we have now learned right? Right line. And how to use the read key in the next video. We're going to examine the Reed and Reed Line Command. See you in the next section. 9. Console Read Readline: Hello, my dear friends. So in this video we will examine the console applications a little further so let's begin. So we only use the read key command to keep the screen on. However, in console applications, the right and right line commands are also used to request data from the user. So here the read and relied commands air used to retrieve the data that the user will write on the screen. And these particular data are kept in the variables. So if the re line command is used to retrieve data, the received data type is string and all written data store. So in this code, the tax that is written on the screen is kept in the name variable. And when we rewrite this data on the screen boom, so as you can see, read line takes the data and puts it into string variables. So the data type of the read command is int. However, the data received with his command corresponds to the first character of the text in the asking code table. Okay, let me show you what that IHS give you an example. So when we write this and run console will ask your name. So right in John. When you press enter, you will see. Dear John, welcome to our lesson and the program will finish. Now. If you press any key, the screen will close. So if you use a read command, that console will ask you your name. Right, John, When you press enter, you will see the 106 one's. Your six is the equivalent of J in the asking code table. Let's try that again now. Right, Sam? The result is 115 because 1 15 is the equivalent of s in the asking code table. So in this part, we learned the console applications, but we won't use these codes in the coming next section. We will use the wind form applications for training. So I look forward to that. See you in the next section. 10. Variables: Hello, my dear friends. In this video, we will examine variables, so let's begin. So essentially, variables are locations in computer memory that are reserved restoring the data used by an application. Each variable is given a name by the programmer and assigned a value, so variables are divided into different types. For example, the end string double etcetera, and we're going to examine these types in detail. Don't worry. Just want to let you know that his purpose is to provide an advantage in the field of memory usage. So because each variable type has a different size requirement for a memory, the variable is defined like this type name or type name value. So here's an example, and child number and population equals 12 or bite. Shoe size bite wait equals 80 and then variable types are divided into four main classes. But guess what? We're going to examine types in five classes. You'll see what I mean in a minute. Imager types, floating point types, text types, logical type and time type energy times. Now, with energy types, you can store energy values within the following range. For example, bite type size one byte value range from 0 to 255. Asked by type size one bite value range from negative 1 28 to 127 short type size two bites . The value range from negative 32,768 to 32,767 you short type size. Two bites. That value ranges from 0 to 65,536 etcetera, floating point times so floating point types are typically used for floating point numbers . You can also use them for energy values. Voting type. Size. Four. You can write seven after point. If the value is not manager, you must write F of F to the end of the value decimal type. Size. Eight bite. You can write 16 after point if the value is not an integer, and you must write the M of em to the end of the value double type size 16 bite. You can store 29 digit number with this type text types text types. Obviously, there are two text times, as you can see here, the chart type size to bite. You can write only one character. You can define a char variable like this and the char letter A drink type size to bite per character. You can write two billion characters. You going to find a string very well like this. String name John. Logical type. Logical type. Bull type. Size one bite. You can use it for controlling something. You're going to find it like this time Type. Daytime time. Size eight Bytes Value. Range from 00000 on 0101 2001 to 23 59 59 on 12 31 9999. Sounds like its far away, but so did y two k a long time ago. Anyway, in the following videos, we will examine the date time type in detail so programmers must follow some rules when naming variables in C Sharp one Variables must start with a letter when naming, they cannot start with a number or ah, special character. String name is true, but string to name or string percent name is wrong to only letters, numbers and underscore Characters can be used when naming variables float. Shoe size is true, but float shoe percent size or float shoe dash size away. Three No spaces can be left when naming variables strings. School name is wrong. If you write it like this, the developer will give you an error. You can write it like string school underscore name that works four c Sharp commands cannot be used when naming variable. For example, you cannot name it like this. String end equals or and true. And we can define multiple variables of the same type by placing comments on a single line , for example and each one edged to edge three string Name one name too. Name three. And another thing you need to remember is C Sharp is case sensitive. So string university and string university are different variables. So if you're gonna be a programmer, you've got to follow these rules during coating. Now, let's have a look at them in Visual studio, open up a new console project and visual studio. The red line means there's an error. So we will write some defining variables here, and we will see the right and wrong usage of defining variables. And so here we're going to define variables that have to start with a letter. So first string name there is no error. Now if we change this to to name and as you can see that comes up is wrong or percent name , and then the other rule that you can use on Lee letter numbers and underscore characters So float shoe size is true. Or add underscore nowhere. If we change that to a percentage or a dash, the air happens again. And then there is another rule. You cannot use this space, so string school name is incorrect. In this case, we can use the underscore character. And of course, we cannot use C Sharp commands is a name, for example, and true or string. And and also we can write Name one name to or and edge one equals 10 edge to edge three. So we have now learned variables. In the next video, we're going to examine variables conversion. See you in the next section 11. Variable Conversions: Hello, my dear friends. In this video, we will examine variables conversion. So let's begin. So sometimes we need to use a value with another type. In that case, we need casting casting as a way to convert values from one type to another. Mainly two types of castings exist implicit casting and explicit casting. Implicit casting with implicit casting. You can use it like this when two data types are compatible. And then when we assign a value ah, of a smaller data type to a bigger data type. Now you don't need to have any special code for this particular casting, so I'll show you an example in C Sharp. The numeric data types are compatible with each other, but no automatic conversion is supported from new marry type two, char or bull. Also, char and bull are not compatible with each other. So before converting, the compiler first checks the compatibility according to the following figure, and then it decides whether it's all right or if there is an error so you can use it like this might to short to end too long to float to double. For example, as you see, cars underscore bite type is bite, but we used it like the short time. So if you write this code, there will be true or false results. Bite X short Why and z Long t float K for example, X equals Why will be false? But why equals X will be true because we have to cast the small type two big type Explicit casting. Explicit casting is pretty much used when there may be ah, compilation error, especially when types were not compatible with each other, for example, assigning a double value to an end data time. So if we want to assign a value of ah larger data type to a smaller data type, we will perform explicit typecasting. So is useful for incompatible data times where automatic conversion cannot be done. No, here Target type specifies the desired type. To convert the specified value to before the explicit conversion, we need to write additional code to convert one type to another. So we have two different ways to do this by using a cast operator or by using the convert class. So if you want to use a cast operator, you have to write it like this. Double Necks is assigned to the value of end by, so we use the value double as end. Now, if you want to use a convert class, you've got to write it like and in the convert class. There are many different types of convert times. Um, so we can see them here in this image that makes it easier to understand. And then we will use these terms as much as we need to in the following sections. Otherwise, think about it like this. All types can be converted to strings. Just add the to string command to the end of the term. As you can see in this code Ah, we can convert the double end float chart types to string. Now variables will hold the last value. So in this code, the S variable holds the positive value. And if we change the code like this, the S variable hold the 12 as its value. So let's see them in visual studio. Open up a console project. And now let's first dry implicit casting. Now we have example bite X short. Why and z long t float k. Now let's try. If we write, why equals X? There is no era four z equals Why is true casting? But if we right X equals Y or why equals E, what do you see? Red lines. And that means there is an error. Okay, so let's try explicit casting. Double ax equals 24. And why? Why equals int x And look, we've used double X like end Now. Also, we can use the convert class who will change this convert dot to end 32 eggs. And as you can see, there is no problem. Now, if you press the dot key after it's converted, you can see all the methods of convert. So, as I say, we can convert every type to a string. I'm giving an example here, double X equals 24. And why equals 12 Load Z equals six HRT equals plus string s equals X to string or why Z or t and of course, variables will hold the last value. If we show this on the console, we will see plus right, right? Line s run and as you see plus so now change locations now The last one is why so we will see 12. Run it. And there you see 12. That's pretty cool, huh? In this video, we've we've learned variable casting in the next video, we're going to start win for All right, See you that. 12. Windows Form: Hello, my dear friends. So in this video, we're going to create our first win form project. So let's begin. Windows Forms is a graphical user interface. A Jew I class library, which is bundled in the dot net framework. So its main purpose is to provide an easier interface to develop the applications for desktops and tablets, PCs and all that. Um, it's also termed as wind forms, which kind of sounds like my summer hideaway, So never mind. First, open up the visual studio and then select, create a new project, then select the language as guess what c sharp from the drop down. Quick on windows forms app. Don that framework in the middle of the current window and then click next. Then after that, just give the project name, um, and could create. So now projects ready for coding. You could, of course, customized visual studio screen by moving the windows with dragon dropped just like that. Or you can hide them for using a larger area. And the next video we're going to examine these windows in detail. See you in the next section 13. Neccessarry Windows: Hello. So in the last chapter, we've learned how to create a new wind form project. Right? So in this chapter, we're going to examine some of the necessary windows for programmers on visual studio. So let's go ahead and get started. We will look at the solution Explorer, Window Toolbox, Window Properties, window error list, Window Server Explorer, Window data sources Window and the Team Explorer window. Let's have a look at him in visual studio, so with visual studio, and then create a win form project. So now we can begin. So we're going to start with a solution. Explorer window. Um, solution Explorer is us really special window that enables you to manage solutions, projects and files. It provides a complete view of the files in a project, and it enables you to add. Or you can also remove files and, I don't know, organize files into sub folders. I mean, it's like a desktop right, for example, we can and a new form like this we're at, ah, new class or folder. We would also remove them just like this. And now when you close this window, you can find it in the view menu. Another necessary window is the toolbox, so the toolbox window displays controls that you can add to your visual studio projects. Toolbox displays on Lee those controls that can be used in the current designer. So for some project types to box may not even show any items, so you can search within toolbox to further filter the items that do appear. And, of course, you can drag and drive different controls on the surface of designer that you're using and then re size and reposition the controls. So for now, we will generally use command control sub menu. Now, when you close this window, you can find it right here in the view menu, and you can also access it with control. Auld acts as your shortcut. Another necessary window is properties, so the properties window is for using um, views and changing the design, properties and events of selected objects. You can also use the properties window to edit and view files of projects and solution properties as well. Every element in Windows form has some properties that you can control with and through this particular window, for example, form element. So look at this. It has some properties and events or button has properties and weaken. Control them within this window and you can find the properties window in the view menu, so another absolutely necessary window is the error list window. The Visual Studio Error list window helps you display the errors, warnings and messages produced during compiling of code and building and the code analysis or ah, in your regular build, or even with some of the other scenarios as well. So we can click on this particular error warning or message, and we can get some pretty exact details. And then the cursor moves to the location where the error or the warning is from. For example, we can write and age and see here there's an error, and then when you click error, the cursor has gone to the error lie very helpful. The error list window is one of the most needed windows during programming. Believe me, when you close this window, you can also find it in the view menu. Now the next window is the Server Explorer menu, so these servers air usually database service such as SQL Sir. By accessing the server, you will access all the databases on the specific server, and then you can build the connections needed inside your program for your program. Um, you also can gain access to SharePoint servers. And of course, when you close the window, you can find it in the view. Many also you can access it with ease. Shortcut control, old s. And here's the data sources window. So with this window, you can access the models of the database tables that you connect to the project. And we will use this window in the following sections when we're working with dot net. But for now, it's just enough to keep in the back of your mind. At least you saw it. What you see cannot be unseen. Now, of course, when you close the window, you can find it right here in view other Windows data sources. You can also access it with Shift Ault D as your shortcut Team Explorer. So the last window is the Team Explorer window. You can use Team Explorer to coordinate your code efforts with other team members when you're developing a project and to manage work that's assigned to you to your team wore all of your projects. Team Explorer connects visual studio to get and get hub Repositories Team Foundation version control were t of the sea repositories. As always, projects hosted on Azure Dev Up Services Warren on premises As your Dev Ops server, you can manage source code work items as well as bills. And of course, when you close the window, you can find it in the view menu. And is there a shortcut? Yes, there is key. Shortcut is control em now. The next video, we're going to examine form elements and the properties as well as events. See you in the next section. 14. Form Element : Hello, my dear friends. So in this video, we will examine form, element properties and events. So let's dig in. When you create a new wind form project Visual studio gives you a form object. So this object has two pages, a design page and a code page. Now we can see the design page, and if we want to see the code page, we just double click in the form or right click on the form and select view code down. We can write code for this design. Now we're going to examine this elements, properties and events. So in the properties window, you can control the form object properties. All elements have a lot of properties and events, but in this particular trading, we're not going to examine all of them, just the ones that are, I would say, the most popular or the most used properties. So this area will include the properties, and this area includes events or actions. First, the back color, as you can see, the back colors used for changing the back color of the form black read or blue, the background image if you want to, you know, at an extra image in the background of the form, you can use it. For example. We can import this picture and use it. We can also, of course, remove it fund properties. Um so you can control the front properties of the form object like bold. And I Talic, you can control the border style like this for let's say, for example, three d text properties. His property controls this tax. Now, if we change the text to reports, as you can see this change So this Texas is only caption for the show user when program is running. Name property is very important for us because this value will be used for accessing this element with code. So the last user cannot see this text. And if we write main form, we have to use this value. Access this form and we'll see them with the other element. Now you can adjust the form size by pulling the corners. You can also, you know, input a particular size with this property. For example, 500 200. As you see the form shrunk Starting position is important because if you don't adjust it, the form can be opened hints. Um, pretty strange areas, for example, the form started here now started here. And how here? If we do it on center, it always starts in the center of the screen on icon like background image. Um, you can change the program. I come. As you can see, we changed the form icon. And with this property you can control the maximize box and the minimized box falls. And look at that. This box it passes. So for now, I think these properties air enough for us to get us going. If you want to learn the others, of course, you can examine them in a form of your own. But I want to move on to events or actions. Now some events can be created when we double click event war. DoubleClick The object, the most important event of the form object is load. So in this action we can write what we want. When the form is loading, we will write codes. When we learned the form elements. Also, we can use click or key actions In this video. We have learned form property. Next video. We're going to examine form elements. See you in the next section 15. Message Box: Hello, my dear friends. In this video, we will examine the message box. So in Windows forms, the message box control is used to display a message with the given text and action buttons . You can also use a message box control to add additional options such as, Ah, caption and icon were help buttons. So now we'll learn how to display a message box in a wind forms app using C Sharp and dot net. Let's see it in a form page so we can use the load. Event of form. The simplest form of a message boxes a dialogue with text and an O. K. Button. This code snippet creates a simple message. Box. String message equals simple message text message box dot show message. So when you click the OK button, the box disappears, or you can write it like message box. Don show simple message text. If you want to give it a title, you know the message box. If you want to give the message box a title, you can write it like this. String Message box title equals message Title Message box Don't show message Message box title. Now you can see the message box has a title now a message box can have a different button as well as different button combinations. Such as? Yes, no. And OK, cancel the message box buttons in new Marais Shin represents the buttons to be displayed on a message box. And they have these values string message equals. Do you want to close this window? String title equals close window message box buttons. Buttons equals message box buttons dot Yes. No, we need a dialogue result Dialogue result result equals message box show message title buttons. If result equals dialogue result dot Yes, this dot close and then this part will be executed when we choose Yes, else. If result equals dialogue result dot No, do nothing. And then this is the one for no. Now we really haven't gone over the if statement yet. But for now, just know that in the message box you will click. Yes. This code will run if you click. No, this coat will run now. Run! Click. No, nothing happened. Try again. Quick. Yes. And the application closed. You can also given icon to your message box String message. Did you see icon String title? Okay. Message box show message titled Message Box icon dot Information. Now run. And what do we see? The message box has an icon, So using a message box in C sharp goes just like that. Pretty simple, huh? In the next video, we will examine the button element. So I will see you then. 16. Button: Hello, my dear friends, who in this video we're going to examine button properties and events. So why don't we just go ahead and begin? So Button, as you may know, is a control, which is an interactive component that enables users to communicate with an application to create a but in control. He simply drag and drop a button control from the toolbox to the form in visual studio. Then, after you drag and drop a button to a form every element as properties and events, so why don't we examine them first up the button has a name property, so it's important because in the code page we can access this buttons properties with this name. The last user cannot see the first button text back color property. You can control the buttons back color if you select red as you see the buttons colors red , the four color property. You can control the buttons text color if you select. I don't know blue, and as you see the text color is now blue On properties, you can control the fund properties of a button tax like this size or Gore bold the Talic image property. You can always had an image or icon to your button like this. So with image a line we can control the place of the icon. As you can see here, text property is caption. So if we change this text, the user will then see the new text. For example. Let's change it. Ah, and look, The button tax was changed. Now, with text align, we can control the placement of the tanks. Ah, OK, you can see that. So also we can control this property on the code page with first button dot text code. Now we right here, it's changed. And in the property window we will see first button gear. But the user, uh, can see it changed. And as you see, the text is changed. But in here the text is first button because the buttons text is changing when the form is loading. All right, so the other property is enabled. It must be true. Otherwise, a user can see the button but cannot use it. So if we do false and run the project, see? Look at that. We cannot click on the button. The visible property must be true. Otherwise you can see it in visual studio, but the user cannot see this button in the program. Let's try it. And as you can see, there's no button on the form we can use this property for important, Button said. Everybody cannot see just Only some users should see this button. Okay, the anchor. Now, as the name implies, this property forces the control to anchor itself in a relative or absolute position within the parent form or control. The anchor refers to the position of a control, and it's either relative to the edges of the form. For example, if we select downright and up now you see the button progresses to down on Lee. If we select right, left and up and run the program, if we expand the form as you see the button move, go from where it is to write up there to the right left enough doc property. So this property means that the area that you don't want to use for the button, for example, if this if you select the left of the form, it will stretch itself to the height of the form, as you can see here, or if you select Phil now the button will fill the entire area of the form, so the location property controls the coordinates of the button in the form. You can drag the button to the desired location, or just enter in the coordinates manually. Like this, you can control the button size by pulling the corners. You can also just manually type in the size of the size property, for example, and as you can see, the button resized max size and men size property. Um, you can use this property. Ah, if you don't want the button to be resized outside of this range. For example, if we give a max size of 503 100 the men size to be 100 50 as you can see, we cannot enlarge more than this. We can also not minimize less than this tab index, so this property tells us that we can access this button with the tab key. When the program is running. Tab Key starts with zero. Add two more buttons as you see this buttons, a tab indexes to and now run Press tab. One to now cursor is on this button so you can control all the elements of the index together with Tab Order, and we're gonna learn that in the following parts. But the most important properties of the button element are these. So let's see the events of this button. The most important event of the button is clicked. So for this action, we can write what we want toe happen when we click on the button. And you can create this event by double clicking here or double clicking on the button, as you can see here. So in this action, weaken right message box show. Hello, now running and click the button. As you see the message box has been shown or we can right there. First button text equals Click now run it. The buttons text changed. The other event. Maybe keep press double click and the action was created. Now, right, first button text equals. Enter now run. So if we press any key when the cursor is on the button text, it will be entered. As you can see, the text changed. So the button elements most popular properties and events and I think we've covered in the other sections. We will examine the label element. In fact, it's coming right up. See you then 17. 16 Label: Hello, my dear friends, who in this video we will examine labeled properties and events. So why don't we begin the last section? I'm sure you remember that we learned the button object, so we examined button properties and event. So in this section we will examine the label control, which is slightly different. So first, just take a label from the toolbox and drag it right onto the form. And labels are one of the most frequently used C sharp controls, by the way. Now we can use the label control to display text in a set location on the page. Label controls can also be used to add descriptive text to a form in order to provide the user with Cem. Well, pretty helpful information. So the label has some of the same properties as the button name that color fund image image , a line text, textile line enabled visible anchor doc location sighs. And I want to let you know that Tab Index has the same tasks is with the button property, so I'm not going to necessarily go over those again in this part. But for more information about him, you could just go back and watch the button video. Um, so generally, we don't use any event for labels, but if you want, you can use a click event like the Buttons Click event. Ah, as I was saying before, we can use the label control to display text on the page, and we can control those properties on the code pages. Well, so first has changed the button text to label control. Then let's say, for example, if we write label one dot text equals first label in the button, click event and run after click Button. Now, as you can see, the label text changed to first label. Alternatively, we can write labeled one back color equals color. Got Red label 1.4 color equals color dot white and run. Correct the button, and now you can see the back color is red and that tax color is white. Now, in some applications, programmers will give a link to a label eso if you want. You could also use the link label. Um, but for now, that's all we're going to talk about. As Faras labels go in the next video, we're going to examine the text box object. See you in the next section 18. Textbox: Hello, my dear friends. So in this video we will examine the text box properties and events. So let's get to it. So the text box is basically used to get input from your users. It can also be used to display some values to the user. So the text box. As you may know, it's a container for text blocks, and you can take inputs or show text as required in whatever your program is in the form of paragraphs. So the text box has some of the same properties. Ah, as with the button and the label for that matter, Name, back, color fund enabled. Visible anchor duck location sighs. The tab index works just like in the button object. So I again won't explain that in detail. Um, if you need a refresher, you could just go back and watch the button object video. Um, so what we can also do because of the text properties, is we can examine them. So if we write something in here, it will be the default value of this particular text box. So let's try running him. So usually we don't write anything there. Um, because, as you can see, the text box is only one line, and we can enlarge it or do anything else. If you want to do more than one line, you've got to use multi line properties. If you do, this is true, and you can use it as multi line. Now, if you do want to use this text box for a password or similar task, you can use the password char properties. So if we right here, char or another, uh, no run and what do we see? All the characters seem to be stars, so if you want to use it like a label and disable writing, you can use the read only property. So if you make read only true, you can see all the text in the text box, but you cannot write or erase anything. So now let's look at events so we usually use a text box for getting input from the user so we don't use events necessarily. But I think there are a couple of events that may have some use for you key press event. So usually we use this event for digit control, So if you wanted take digits only from the user, then you can use this event, they'll both work the same for this particular action. And as you can see here we can. We can write everything in the text box, all right, this code in a key press event. They're now run, so we cannot write any character except a digit and point. Now let's see, with the on screen keyword and what we see here, if I press the letters, there's no letter appearing. But now I'll press a digit or a point. And as you can see for each key, yes, key presses running. So let's examine this code while we're learning the if else condition. Now, as I said, we usually use text boxes to get the, uh, well, any relevant input from the user. So let's say, for example, that we have, ah, label a text box and a button. We can write the text boxes data to a label with the buttons click event Input value is string type, so we have to hold this value in a string variable and now in the click event of the button . If we right string labeled text equals text box one dot text and label one dot text equals label text Run project Now right, Try to change label text in text box and click. As you can see, the labeled text changed with an attempt to change the label text. So if you want to use numbers with text box, you can convert text to imager or float types so the text box can take 32,767 characters. No, if you want to write more than this, um, well, you can just use the rich text box all the same properties except for rich text box contain Well, quite a few characters. In fact, well over two trillion, so we use it usually for really big paragraphs. So in this video we have learned some properties and usage of text box. And in the next video, we will examine the group box. So stay tuned. 19. Group Box: Hello, my friends just is. We promised. In this video we will examine the group box. So let's begin. A group Box control is a container control that is used to place windows form child controls into a group. So the purpose of a group box is to define user interfaces where we can categorize related controls, you know, in an organized group. So, for example, let's say that we want to create a special area and a form, and we want this area, um, to use on Lee. Well, actually eso that it appears only to certain users. So we will use a group box, and then we will drag the necessary elements into the group box. And if we, um, just put the visibility of the group box to falls and now running right now, As you can see, all the elements in the group box are visible. So let's have a look what they are. Group box has name a back color fund enabled visible Anchor doc location and the tab index properties work just like the button properties. For example, if we make, um, if we enabled false, then we cannot access elements in the box group, but we can use the other element that are out of the group box. So Group box has events, but usually we don't use them. And fact in this training, we won't actually use these events. If you do want to use them, Um, just use ah, Just use him like the like the button events. Ah, in the next video, we're going to examine Radio Button. See you in the next section. 20. Radio Button: Hello, my dear friends. In this video, we will examine the radio button, So why don't we begin? A radio button or option button enables the user to select a single option from a group of choices when paired with other radio button controls. So in other words, when a user clicks on a radio button, it becomes check radio buttons air usually placed in a group on a container control such as a group box, and only one of them will be selected. But the most important difference between radio button and check box is you cannot change. Check falls after that radio button this check. As you see here, radio buttons have the same properties as a button name back color fund, four color image image, a line text, text, align enabled visible anchor, doc location. And, of course, the tab index works just like in the button Objects except the radio button has a couple of special properties, of course, right. So check a line properties, and we can control the check place in this element if we select the middle right. As you can see, the check place has gone over to the right and check properties is the control default value. If we make it true when the programs is started, then you can You can see the radio button. This check now. If you want, you can control this property with code. Let's see what that looks like. So have you write radio button one dot check equals true. You can see that the radio button this check so we can give it true or falls value for being Jack to run, checked. And if we want a store stored in a variable, we will have to hold it with a bull variable. In the event area, there are so events like click, but we generally use checked change event so the value is true and you make it false or vice versa. This event will run So, for example, we will write in this event message box show checked, changed and run. As you can see when I change, the Czech State message box appears, and usually we'll use more than one radio button. But for now, we they haven't learned the if statement yet. So um, you'll understand that when we get to that, so we will use Ah, we'll use more than one radio button. After we learned the If statement, I don't keep talking about it. Don't worry. Stay tuned. We'll get to it because in the next video, we're going to learn about the check box. See you then. 21. Check Box: Hello, my dear friends, thank you for hanging in there. We will get everything I promise. Especially that if statement, But first, we're gonna hit up the check box. Okay, So let's begin. So dragged the check box into your form and the check box will allow the user to give specific input. It's mostly used where we have to retrieve specific data from the users such as, I don't know, like a gender selection in terms and conditions, agreements and and age restricted data. You know, that kind of thing. You see check boxes all the time. You can simply use a single object c sharp check box or multiple objects. It just totally depends on the requirements of developing whatever desktop application you having to be developing at the time. Most of the features of the check box are the same as radio button. For example, name, back color fund, four color image, image line, text, text, align enabled visible anchor, duck, location. And, of course, the tab index works just like in the button object, except the check box has a few special properties, so check a line properties. That means that we can control the place of where that check boxes in this element. So if we select the middle right, as you can see here, the check places gone to the middle, right check properties is, ah control default value. If we make it true, when the program is started, you will see the check box is checked. Now, if you want, you can control this property with code. So if you write a check box one dot checked equals true, you can see that the check box is indeed checked. So, of course, we can give a true or false value for a check to run check box. And if we want a store of variable, we will have to hold it with a bull variable. Now in the event area, there are some events like Click, but we generally will use the checked change event. If the value is true and you make it false or vice versa, this event will run. So, for example, will write in this event message box show checked, changed and run. And as you can see when I change the Czech state, the message box appears, or you can use the Czech state changed. It's now just right in here. Message box dot Show check. State changed. Now, run. As you can see, do events were so you can choose whichever one you like. Uh, in the next video, though, we will examine the combo box. See you in the next section. 22. Combo Box: Hello, my dear friends. So in this video, we will examine the combo box. So let's begin. Awesome. So I've, uh, talked about C Sharp button control before and its features. So Combo box is quite similar to button control, but its major properties are different. The combo box can hold multiple values at the same time, so it's like a drop down box and appearance, and you can select any value inside of it. So most of the time, the combo boxes used to give the user multiple selection options. Um, but in sign up forms, it's used for country selection, where you have to select your country from a rather long drop down so you can use a combo box according to your particular requirements. So when you click, the arrow window will be opened and then you can add items to the combo box Using edit items, you just write your items and press enter for new item, and if you want to remove, just use the delete key. If you want, you can use bound items. Check. So now you can adjust different text of the display and value, and if you want, you can add items on the code page. So if we right combo box one dot items dot add Sunday combo box one dot items dot add Monday combo box one dot items dot ad Tuesday And now if you write combo box one dot selected index equals one. So, of course, in programming, the index starts with zero right? So if you write one, this means that when the program starts, you will see Monday in the combo box. And, of course, if you want, you can change it. So now start the project. And as you can see, items will appear in the combo box so you can choose anyone. Now, let's look at some of the properties. Name back color fund, four color enabled visible anchor doc Location sighs. And guess what? The tab index works just like the button properties except ah, the text property show caption before any item is selected. Sorted property is great to use, Um, because it will use it here in the items it will sort from A to Z or zed. If you live in other countries, it doesn't say Z, um, but now, as you can see, it isn't sorted right now. So now we'll make it true and run it. And as you can see now it's sorted. So if you want, you can add a list or data from a database to combo box. And you know what? We're going to learn those in the following sections because I just wanted to give you an idea of what combo box is. Four. Because another great part is weaken. Get data from a combo box in four different ways. Selected text Selected Value Selected Item Selected Index. We will examine the selected item Selected Index so with the selected item. So with this command, we can get all of the values of the selected element in the combo box. So the value is object time. For now. In our combo box, we have only string value, so we can use it with the two string cast. So, for example, in the button click event well, right string Selected item equals combo box Selected item to string and then show it with a message box like message box show Selected item. Now select Monday and click the button and you see Monday So like Sunday, click on Sunday and then the other one is selected index. So with this command you can access Onley selected items in their order in combo box. Ah, so if you add a new item in the combo box, the order may be changed. Or if you change the sort of properties the selected index value may be changed. So usually we will prefer to use the selected value or the selected item. So with this command, we will get an end type value and let me show you how we use it. End value Order equals combo box Selected index and show in message box with two string casting now run Monday. Click value is zero and now change this sorted value to falls now, right, Ondas, you can see Monday's warders changed to one. So now let's move on to combo boxes events. So Combo Box has some events like click or key press like button or any of the other elements, but will usually use to events that are particular to combo box selected index changed or selected value changed. Both of them activate after the same process. So when you change combo box selected item, for example, it ah, it can use to labels, then DoubleClick selected index changed right label to text selected index changed plus selected text now double click selected, valued changed. And now right here Labour one dot text equals selected value changed plus combo box Selected text Now run program. And as you can see, when we change the combo box, selected item labels text are changing. So for now, that's enough about the combo box. I'm sure you get it. If if you need to review some, that's cool. We will do a few examples with combo box in some of the following videos. So don't worry. We're not gonna leave it alone. Uh, in the next video, though, we will examine the date time picker. See you in the next section. 23. Datetime: Hello, my dear friends. So in this video, we're going to examine the date time picker properties and events, So I don't think I need to tell you anything more. In other words, let's begin. So the daytime picker control allows you to display and collect date and time from the user with a specified format. Date Time has some of the same properties as with some of the other element, like name fund sighs, anchor Doc enables. And these properties work pretty much the same as the other elements except the date time picker has a few properties. For example, with the Foreman property, you can choose what you want to show to the user, so it's now long. For example, let's select short and what do you see? The date time content display changed, So now we can only see the date numbers or let's make it time. Ah, look now on Lee sees time, so if you select the custom, you have to give a format type in the custom format area for days. D. For months, Big M four year. Why, for our H and for minutes you have to use a little limb. Now it's doing example. So right. And as you see you can use on Lee days and months now, if you change to this, you can see day, month and the last two characters of the year Men Date and Max date. You can use them for giving a range. So if you make them in date 11 2000 you can't use any days before this like this. And if you want, you can adjust these properties on the code page. Daytime picker also gives us a value of type date time, so we have to hold this in a daytime variable in order to use it. For example, in a click event of the button, type we right, daytime birthday equals date time picker one dot value Now show with a message. Bonds type is daytime, so we have to cast it to string and now run program Click. As you can see, we can take the value from the daytime picker. Now, if you want, we can. We can change this value with an ad command. Let's see, For example, if we write and years, two year will be 2021 so let two s show them on the label and to label. And now in the button. Click right label one text birthday. Add two years too short date string and able to text. And minus two years have you used the minus sign Year will be decreased. And now run the project. Click the button. And as you can see, this 1 2017 And this is 2021. Daytime has events like clicks, but generally we use the value changed event. If we right message box show date time picker one value to short date string. Now run as you see when we changed date message box content changes to the new day and the toolbox. There are some elements that generally we can use in applications, but we're not gonna learn them yet. But I'll show you, for example, we've got data grid view this box, open file dialog and timer. We will postponed them, Uh, and we'll learn them when they're necessary in the upcoming videos. But for now, these elements that we learned is enough to get started. So in the next video, we will examine the switch and data transfers between forms. See you in the next section. 24. Switch and Data Transfer Between Forms: Hello, my dear friends. So this is a video that we will examine the switch and data transfers between forms, So why don't we just begin? So now let's open up a new project and let's name the form FRM get data and at new form FRM show data Now First we have to learn how we can open the other form. So we'll first at a button to the get data form. Now let's create a click event and we're going to learn the next bit in a in a class video . But from for now you must know this. So if you want to open the form first, you've got to create it in code so well, right FRM show data of RM show equals new form show data and that's pretty much how we created the form with code. So now we will show it and we can use to different commands show or show dialogue. So let's first you show right of RM show Don, show, run! And now if you click the button, show data formal open And as you see with the show command we can use to forms together. Of course, if you don't want to use them together. Then use the show dialogue. Change this to show dialogue. Run now. As you can see, we cannot access the other form. But, hey, we didn't want to write. All right, so now let's do up an example for data transfer. So let's say that we want to ah, you know, have user input. Right? So we get data from the user in a get data form, and then we show them that data in this show data form. Now add to text box to the get data form, and we'll adjust the names too. Text name and text. Surname. Good. So now add a label to the show data form and we'll adjust the name too. L b l name surname and change the modifier property to public. Of course, you remember that if you give a public property too any element you can access that element from every other page. We're gonna hit that up more in classes when we get there. But for now, So now in the button click event. First, get data from text string name txt name, text string surname D, x T surname, text string, name, surname. name plus surname and now we will send the other form. So if we write frm show dot l b l name surname text equals name surname of RM show don't show now run. So that's right, Charles Dickens and Click. As you can see, the label text is Charles Dickens. So it's close that and let's write in George Orwell Click and it's changed to George Orwell . So in this video we learned how to switch and do data transfers between forms. Pretty simple, huh? In the next video, we will learn how to use. Are you ready for it, Operators? See you in the next section. 25. Operators: operators. Hello, my dear friends. So in this video, we will examine operators in C Sharp. Very important, very Value bowl. An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Yeah, C Sharp has a rich set of built in operators, and it provides the following type for you arithmetic operators relation ALS operators, logical operators assignment operator. So arithmetic operators air defined for all of the numeric data types, operators plus minus asterisk or star or multiply um slash or divide by represent the basic binary arithmetic operations, addition, subtraction, multiplication and division. Now the operator percentage is the remainder after division. Now the important thing to notice and to remember here is that the plus operator behaves differently with the number in string types. So with the numbers, the result of expression 15 plus 40 is 55 but with the strings the result of expression 15 plus 40 is 15 40 so with the number type, it's in addition operator, but with a string type, it's a con canton ation operator. Now we use plus plus and dash dash uh, in order to increase by one or decrease by one whatever number we're we're on. So let's examine them in a table. So if this is our table, as you see, a plus B equals 60 but D plus F equals 2025. See percentage A equals zero C plus plus equals 31. A minus minus equals 14. So relational operators air used to check the relationship between two operations. If the relationship is true, the result will be true. Otherwise, it will result in a falsehood or the result will just be fault. Um, relation. All operators are also used in decision making. Like if and loops like four. You can see some examples on this table only you can use equal, equal and not an equal operator for string times. The others must be used for numbers. Logical operators who used to perform logical operations such as and or logical operators operate on Boolean expressions true and false, and they will return Boolean values. Logical operators are used in decision making and loops, So the following table it will show you the relationships of true and false. And if you have a look here forever, sand. If one of the Miss Falls result will be falls and four pipe. If one of them is true, the result will be true. Exclamation mark calls logical not, for example, a is true. And if you write not a it means false like not equal assignment operators. So on assignment Operator is the operator that's used to assign a new value to a variable in C sharp programming. With these operators, you can due process and assignment together for a equals 20 and as you see, a plus equals five is already a equals. A plus, 25 or a minus equals five is already a equals a minus five and transaction results were here. Now, of course, there are some operators that we have not learned. We will be explaining those in future lessons as they come up in as they're needed. But in this video we pretty much learned the operators. So I will see you next. Video 26. Comments: Hello, my dear friends. So with this video, we will begin to learn some pretty important properties that we can use in programming. So we will start with comments and we'll begin right now. So comments are used for explaining the code and are used in a similar manner. UH, N C. Sharp and Java and C or C Plus plus etcetera compilers. Ignore the comment entries and do not execute them. So generally, programming languages contain two types of comments. But in C Sharp, there are three types of comments. Single line comment, multi line comments, XML documentation, comment. So for now, we're just going to examine the single line and multi line comment So the single line comments are used to comment a well single line. So these comments can be written in a separate line or along with the codes in the same line, but for better understanding. Let's always use the comment in were on a separate line eso For this, you can write a double slash ahead of the line like this, and multi line comment are used to comment on more than one line. Generally, it's used to comment out an entire block of code statements. So this comment you must right slash and star at the head of the block and you must write star and slash at the end of the block like this. All right, so now let's see it in visual studio new. Open your form and tree label and a button and now create a click event. Now, right here. Label one text equals first label label to second label label three third label Now run. So when we click Aziz, you see here all the labels text have changed, and now I'll put a comment on level one Now run and labour ones text didn't change Well, able to and three changed. A single line is using just like this. Um, you know, if we need multi line, of course, to do all three labels erase this comment now. Right slash Star here and star slash here now on Lee Label three will change. So let's see. Run. As you can see, label one label to did not change. And if you want, you can put comments like this or you can remove them. And in the next video we're going to examine region. I'll see then 27. Region: region. My dear friends, in this video, we will examine region just like I promised. So why don't we just begin? So the region directive partitions your code with region, we can organize code into blocks that we can either expand or collapse visually. So we must indicate the start of the region as well as the end of the region. For example, if you have a big class which has more than 1000 lines of code and it is difficult for you to find any particular code, you can use this for hiding 800 lines and you'll only see these 200 lines. All right, so when you do want to use it, you've got to write sharp region ahead of the block and you have to write sharp end region , the end of the block like this. And now let's see it in visual studio now, right? Labour won text, text and then reproduce with copy paste. Now we have 400 line now, right, sharp region, and go to the end, right and region. And now you can hide the code using this minus in the next video, we're going to learn naming conventions which will be helpful. See you in the next section 28. Naming Conventions: Hello, my dear friends. In this video, we will examine naming conventions, so why not begin? So for any developer naming conventions is, uh, well, I would call it a best practice when you're working on any development project. Why Naming conventions naming conventions became very important in the world of programming with the introduction of complex codes, especially with the development of object oriented programming languages. Naming conventions are very important in order to identify the usage and the purpose of a class or of a method then to identify the type of variable and arguments. Programmers usually work with a team, so all the team members have to understand all of the codes. So if you use naming conventions, it's effectively using. We're speaking the same language with all of your fellow programmers now, since the name selection processes, I'd call it mechanical. You don't have to really think about it so you can work fast, even write fewer comments that way, since your codes will of course be understandable. So there are some naming convention times, but in my opinion, ah, two of them right now for this course are enough for us. We'll call them Pascal casing and camel casing. So in Pascal casing, the first letter of each word is capitalized, and we use paschal casing for class names and method names. Camel casing is like Pascal casing, except the first word starts with a lower case, so we'll use it for method arguments and local variables and form elements. Public class client activity is pascal casing, and personal number is camel casing. Now, in our training, we used these methods for naming, and we will be using the following terms for four mountains form form is a class, so the first letter is capital label lbl button text box txt combo box, CMB Check box Radio button R B date, time picker, DP Group, box G B. So, for example, let's say that we have a form for ah, personal information. Well, right, form personal information. Or let's say we have a label for a student's age and will name it lbl where? Label student age. Or let's say we have a combo box for university name and we'll write CMB University name or a text box for employees. Salary will name it. Txt employee salary. That's it, right, So that pretty much wraps up the naming convention, and I not only encourage you, but I would suggest that you hold these fast as rules for naming. That's how you become a good program already then. So in the next video, we will examine break points. See you then. 29. Break Points: Hello, my dear friends, who in this video we will examine break points. So why don't we just begin? So in projects the process of catching errors is always very important, of course, but it can be difficult. So when coding with the C sharp language, in fact, in any language that you program in, we will encounter three different kinds of errors syntax, errors, run time errors and logic errors. Syntax errors. These, I think, are the easiest errors to fix. Visual studio error messages enable us to quickly find about 99% of the syntax errors. Run time errors, which is most of the time our application crashes. Visual studio will report to us, um, the line of the air. In fact, we can easily find it and solve the air logic errors. These errors are, I'd say, the most difficult errors to find and to solve. Ah, for example, you can have developed an APP, calculates a student's g p t. However, if your application calculates the grade point average 1 20 but the max is 100 than theirs . A logic error in your application. In unfortunately, visual studio won't throw up unerring message to help us out because, well, there's no violation of C sharp grammar. So for these states, we can use break points. So let's have a look at that in visual studio. So with this application, um, as you see, we can calculate our g p t. So let's try 1st 40 Final exam 50 calculate. And as you can see, the result is 480. But how can that be? It cannot be right, so there's got to be a problem somewhere. But our program has already run, so we made a mistake in our algorithm. In smaller programs, looking over the code is often you know just what you got to do, and you can pretty much find whatever the possible problem might be just in, you know, proof reading if you will. But that approach doesn't really work with complex programs, as you might imagine. So that's when we use break point. So first, let's find button Ah, click in code, and if you left click, the line is you see that produces a Redpoint, so that's our break point. It means that the program will pause at this wine, so let's see it run 40 50 calculate. Okay, so now it's yellow. And that means that the compiler is executing the coat and you can run it line by line with the F 10 key. So now we can control our variables. And what we see here, the midterm exams value is zero. So we'll run the code with have 10. Now, look at the midterm exams value. Ah, 40. So there is not a problem. Their final exam zero for now. So we'll go on have 10 final exam 50. So it's true. G P. T is zero. So go to F 10 and now GPD is for 80. So here we found the problem source. Right of you can examine this line, I think you can probably find the problem. So if we change this who A plus, we can solve the problem. So let's run it again. But if you press f five, the program will continue until the next break point or the end of the code. So if there's a function in your line, you can go to this function with F 11. And as you see, GPT is 46 and indeed this is true. So we fixed our problem. Now there are also tree windows that you can use with break points. So in really big projects there, maybe, ah, lot of break points. So with break points windows, you can see all of them. And if you double click any of the break points, you can then go to the break points line as you see where the cursor is in this line. Now, just double click and the cursor went right to this line. And you can, of course, remove break points just by the leading. You can access this window with debug windows break points, and the other window is the immediate window. From this window, you can see variables. Values are writing. Run program now, right midterm exam in the window press enter and you see zero F 10 now right again mid term exam. Enter now the value is 40 so here you can see the values. With this window, you can access this window with debug window immediate, and the other window is the watch window. So if you want to see more than one variable value, you can use this window first and variables to the watch window with, he add watch. Wild break point is active. Mid term exam. Final exam. Now you can see these values step by step 00 40 0 40 60. And you can remove variables with delete, watch or clear. So what do you think This is the section that we learned about break points and how useful they are for programmers. In the next video, we're going to examine shortcuts in visual studio, so I'll see you over there. 30. Short Cuts: Hello, my dear friends. So in this video, just like I promised, we will examine some shortcuts for visual studio. So why don't we just begin? So in visual studio, we generally use shortcuts for fast coating in the following table. You can see that it shows it some of those shortcuts for visual studio. Let's have a look at them one by one. So let's see in the table f five. And that launches the application under the D Bugger based on the settings from the start up project and went in break mode. Invoking this command will run the application until the next break point. Have six. Build all the projects in the solution F nine set or removes a break point at the current line. F 10 execute the next line of code but does not follow execution through any method calls. F 11 executes code. One statement at a time. Following execution into method calls, F 12 navigates to the declaration for the selected symbol and coat tab inserts the expanded code snippet from the shortcut name. Tab Tab inserts the expanded code snippet from the shortcut name controlled space completes the current word in the Completion list Control K s displays the code snippet picker. The selected code snippet will be wrapped around the selected text control K D formats. The current document control M M Toggles, the currently selected collapsed region between the collapsed and expanded state control M O collapses The declaration bodies to provide a high level view of the types and the members in the source files control K C in search comments at the beginning of the current line or every line of the current section. Control plus K. U removes the comments at the beginning of the current line, or every line of the current selection Control WP displays the Properties Window, which lists the design time, properties and events for the currently selected item. Control H displays the replace options in the quick replace tab of the find and replace dialog box. Now these are some of the most commonly use shortcuts. If you really want to know more and need more shortcuts, you can visit the visual studio's website. In the next video, we will examine the if else statement. I know a lot of you have been waiting for that one. It's very important, so I'll see you there 31. If Else : Hello, my dear friends, who in this video we will examine the if else statement it's highly anticipated. It's very important. So let's begin condition controls. So testing a condition is inevitable. And programming we will often face situations where we need to test conditions, whether it's true or false, um, to control the flow of the program so these conditions may be affected by a user's input time factor may be the current environment, or where the program is running all of that kind of stuff so we can make these decisions with three different ways. The if else statement, the switch case statement and the turn ary operator. In this particular part, we're going to learn the if else statement for making decisions. The if statement. It's one of the single most important statements in every programming language. Remember, it's the if statement, so being able to set up conditional blocks of code is a fundamental principle of writing software. N. C. Sharp. The if statement is very simple to use. If you've already used another programming language, the chances are that you can use the if statement in C sharp straight away. Um, in any case, let's Ah, let's go on to see how it's used. So the if statement needs a boolean result. So that is if it's true or false. So the if statement works like this. If a particular condition is true, then the compiler executes Operation One. And after that it goes on and executes operation to. If the condition is false, the compiler won't run Operation One and it will go on with operation to. So this is how we use the if statement. So in the if condition, we use relation Alaa operators and logical operators. So here are some if statements using so as you can see you can write control equals equals true or just control. For bull types, you can write more than one condition in one of statement by using logical operators. So every if has a block. But if you only have one line in the block, you write code without curly braces. But if you have more than one, you've got to use just like this. So if you write more than one, if it means that you will control all of them and all of the ifs, true result will be executed. For example, in this code, all the if block will run and if you want to run only one of them, then you must use the else. So if the expression is evaluated to be falls, the block of code inside the else statement will be executed. And let's have a look in this schema. If condition one is true, then the other codes will not execute. But if condition one is false, then the compiler will control condition too. So if you use the else statement, you can only use one block of them. So, for example, in this code Onley, the if block three will execute. So while using the else statement, you have to write your conditions from ah, more important to less important. So sometimes you may need a nested if there's really no difference between using that and a normal if statement, so as you can see in this schema. If condition one is true, then the compiler will execute condition too. If condition too is true, the compiler will run Operation three or if condition one is false than the compiler will execute Condition three. And if the condition three is true, the compiler will execute Operation One, and that's the code that pretty much illustrates how we use the nested if now we'll have a look of them in visual studio by using break points. So open up visual studio and create a new project at a button, a label and a text box in your project. Now create a click event of button and now right in this code into your project. - Now I had a break point and run it, and if you did what I did, you can see that the label text is labeled one, and the text box text is clear. Now click the button and the break point is active. Now press F 10 for a break point. The program executed the if block one because A is 20 so it means that the label text will change. Let's go on if blocked, too wasn't executed, so the text box text will stay blank and we'll go on. If Block three was executed, you will show a message box. So now it's president F five and have a look at the results and what do we see? The label text changed and there is a message box, but the text box text didn't change. All right, so now let's use else at a new button. Adjust that text if else control, create click event. Now write this code now . I had a break point and don't run quick if else control button The break point is active. Press F 10 and what do we see? The If Block one wasn't executed because A isn't 30 it's 20 if block to was executed. And as you can see here, the compiler didn't control the other statements because only one of them can be executed. Now, if you remember in the message box video, we saw an if, but we didn't really know that much about it. You could probably figure it out, but let's use a message box with an if statement to drive home the point. So it's at a button and just write this code, and now we will get the results. So we have to write if statements. So first start with yes If result is yes, text box text equals Yes, was chosen then. No else. If result No text box text equal no was chosen else. This means cancel was selected text box text. Cancel was chosen. Now let's run it and see the result, and you can see yes, no or cancel and the message box. And that's how the if else statement works. So let's now learn the turn ary operator. So it works like if Ellen's. But with this operator, you can only write if and else so let's see what I mean at a new button. Change the text to turn ary operator and creative and and now right this code. So this means if a is less than B turn, every result will be beat and else turn. Every result will be a B is bigger than a so we will see 20 in the message box. So now let's run it. And just Aziz, we predicted you see 20. So the turn every operator gives us an advantage here that we can write the if else statement in a line. So in this video we learned the FL statement. In the next video, we will learn this which case struck. See you then 32. Switch Case: Hello, my dear friends, who in this video we will examine the switch statement. So let's begin. So another form of selection statement is the switch statement and that execute ah, set of logic depending on the value of a given parameter. So it's a set of logic, right? The types of values a switch date men operates in were on can be billions. Denham's integral types and strings. You can see just how the switch works in this schema, and that is pretty much what using switch looks like there is only one true condition in this case. So the compiler goes true. One doesn't go to the other. So in this code, the true cases six. So the compiler executes case six break means after the true case was executed, it'll exit from the condition. And if we need ah, nested switch, then we can do it like this. So in this code message text, this will be X equal six. Why equals three? No. Usually use an NFL statement in our project, but sometimes we can do it like this. Let's have a look at it in visual studio open in visual studio. Create a new project or, if you want, you can use one of the old projects. That's fine at a label text box and a button. And let's adjust the locations. Right. Label one X Onley 246 eight. Now create a button click event now, right and thanks. String message Text case. Two Message text. X equals two case four Message text X equals four case. Six Message text. Thanks equals six. Default message. Text X equals eight. Now. Right message box show message. Text out of the switch at a break point. Run right six and click. The button break point is active, so press F 10 X equals six. So break point went to K six and the break is now on message box. As you can see, the message box shows X equal. Six. Let's try 12. Now run and let's ah, go the F 10 key. And as you can see, the default case runs and that result is eight. All right, cool. So now let's write a nested switch at a label and ah, text box. And now all right. In Case six. Switch and now run Next value. Six. My value to click press F 10 excess six. So we came back to Why? Case? As you can see why is too so our message will be X equals six y equals two. Now press F five. See message box X equals six y equals two. Let's try it again. X equals two. Why? Equals ain't click, have 10 and as you can see, the break point Didn't go to the other case have five. So our message box shows X equals two ref agg. So in this video we learned this switch case in the next section We're going to examine loops in dot net. So get ready. I'll see you on the other side. 33. While Do While: Hello, my dear friends. In this video, we will examine the while and do while loops. So why don't we begin? So in real life, we will do some repetitive tasks that we need to do. And sometimes we have to do them multiple times and doing the same task again and again, over and over. It could be repetitive, gets boring, and it can even become a hectic or frenetic pace. So that's the case in programming to I really find it. Programming mirrors life a times, um so there are situations where you do have to write a program statement or execute a set of logic multiple times, or even display a message with sometimes slight variations in numbers. So obviously doing this form of work manually will be a completely time consuming effort, and you're just gonna lose your mind. In any case, it will become less effective, right? I think we can agree with that. So looping and programming languages is a way to execute a statement or a set of statements a multiple number of times, depending on the result of the condition to be evaluated in order to execute statement. So the resulting conditions should be true. In order to execute statements within loops, let's have a look. Loops are mainly divided into two categories. The entry controlled loop and exit controlled loop entry controlled loops. So these air the loops in which the condition to be tested is present in the beginning of the loop body and her known as entry controlled loops. The while loop and the four loop are examples of entry control loops, exit control loops, so the loops in which the testing condition is present. At the end of the loop body. We call these exit control loops, so in exit control loops, the loop body will be evaluated for at least one time as the testing condition is present. At the end of the loop body do while is an exit control loop, so why don't we go back and we'll start with the wild loop? The test condition is given in the beginning of the loop, and all the statements are executed until the given Boolean condition is satisfied. When the condition becomes false, the control will be out from the while loop. So in the following schema, you can see wild loops, and it's working structure and what we see here. The loop starts with the condition control. If result is true, then the loop lock executes. When the result becomes false, the loop will end and the compiler runs the following codes, and that's pretty much the wild. So let's see an example in this coat loop. Work amount shows that a while loop has run. How many times? So for every true value of the condition, the loop will work and the loop work amount will increase by one. So if we run this code, you will see 10 message boxes. Now guess what we can also use nested while loops, for example. This code belongs to a nested wild loop. So in this code, for every in loop control value in loop work amount shows eight times and for every out loop control value in lieu, control value and out loop work amount works 10 times, so in loop work, amount works eight times 10 which is 80 times, and the message box will show that the out loop work 10 times and that the in loop worked 80 times. So for now, that's all we need. Teoh really talk about regarding the wild loop. Um, the other loop is the do, while so the opposite is true for the do while loop, which works like the wild loop. But it has some other aspects, too. The do while Loop evaluates the condition after the loop has executed, which make sure that the code block is always executed at least once. As you can see in the following schema here, Operation works before the condition, so it's, ah, fairly simple operation. That's how it works. So let's have a look at this code. It shows us that before the control loop control value less than 20. So we already increased this value and the message box showed us 10 a nested do while loop works just like a nested wild loop. And now I think that's pretty much all that we need to cover right now about the while and do while loops. So let's run these codes in visual studio, and you can get used to their action. So now let's open up a visual studio and a new project, or can choose one of the older ones at a button at a text box. No adjust multiple of text box to be true. Adjust the text two while loop double click. Now write this code with me. Loop work amount will give us that while Loop works. How many times and for each value we will write it to the text box. And now let's add a tree break point. That's why we learned him. So now let's run. And first we see that. Ah, we see how the while loop is working just as you see the condition that went took the code block. Now we will count the break point stop on loop control value with just the single press of F five after 10 break points went out from Loop and F five, as you can see in the message box that shows 10 in the text box includes each value of the loop work amount at a new button and adjusted text to do while now just copy this code and paste it in do wild button and adjust it for the do wild just like death. Now we have to clear the text box. So at a break point and now run and what do we see? The first came into the condition block after it went to the wild control, and then it goes on and we see the same result is while and do while. But we change the location of this line. Now run. As you can see, the numbers are ordered from 1 to 10. So now let's have a look at the nested loop in the watch window. So first changed the codes and button one and and break points. Now run click button. Now add watch in loop control, value out loop control value and in loop work amount variables and now use the five in order to see the changes of the variables. And, as you can see for each value of the out loop control value, the in lieu control value takes its value from 1 to 8 and go ahead and remove the break point. Now press F five and what we see. The message box shows us out loop work 10 times, and the in loop worked 80 times. How is that? So in this particular video we learned the while and the do wild herbs the next video, we're going to examine the four loop see over there 34. For Loop: Hello. Hello, my dear friends. So this is the video that we will examine the four loop. So let's begin. The four loop has similar functionality as ah and to the wild loop, but it's got a different syntax. Four loops are preferred when the number of times a loop statements are to be executed is known beforehand. So the loop variable initialization, the condition to be tested and increment and D increment of the loop variable is done in one line in the four loop. And that's how we get a shorter and easier to debug structure of looping. Now the following schema shows us the working structure of a four loop, and as you can see here, the if condition is true. The operation will run, and when the condition is false, the loop will end and the compiler goes on with the following coat. And that's the working of the four loop. So here let's have a look at the variable initialization condition and increment variable, for example, in this code for each value of I that I value adds a number to text. When we run this code, the message box will show us numbers from 0 to 9 now. Also, we use nested loops with four if you remember. For example, if we write this code, we will see in the text box each value of K for each value of I. There is another loop name, which is for each. Now it's used for a raise, but because we haven't covered a raise yet, Um, we're gonna have a whole section on a raise, and that's when we'll get into that. For now, we're only gonna learn what we can use. So the sin tax time is this, and it works just like the four loop. And for now, I think that's enough. Um, but that's pretty much reps. The for each loop. Um, do you wanna have a look at the four loop and visual studio? I know you do, So that's open up a new project at a button. Just text 24 loop Now create a click event right string. I value I Value Plus equals a space plus I, plus a space. Then write message box dot show I value down to the block. Now run the program when we click the button. As you see the message box shows US numbers from zero tonight. So let's put a break point and run it step by step. Break point is active. Let's see. With the F 10 variable was initialized in. The condition came in 24 blocks. Now incremental. Did I again run condition again? Came in to the four block and that's the working structure of the four block. Now are you ready to write a nested for? So let's write four K less than eight first at a rich text box to your form now, right, rich text box, text plus environment, New line environment New line will give us a new line in the text box for each loop value. Now, run. And as you can see, the text box shows us each k value for each I value. So we're not going to get into a raise like I mentioned. So I'm not gonna show it to you, even But for now, you can see the four each syntax and that's this. So now we've covered and we've learned hopefully loops in the next section we will learn, break continue and the goat two statements. Um, I'll see you there 35. Jump Statements: Hello, my dear friends. In this video, we will examine jump statements. So let's begin in C sharp jump statements. Air used to transfer control from one point to another point in the program due to some specific or specified code while executing the program. So basically there are five key words in jump statements. Break, continue, go to return. Throw. So in this part, we're going to learn, break, continue and go to. We will learn the return methods in this part and we will learn throw in exception handling . So let's start with break. The break statement is used to terminate the loop or statement in which its present. Then after that, the control will pass to the statements, um, that present after the break statement if available. If the brake statement presents in the nested loop than it terminates Onley those loops which contain the break statement. So let's have a look at the following schema and you can see the brakes working structure. So as you see, when the break code is executed, loop will end and a compiler will run the code after the Usually we use him in loops with, if otherwise, we cannot control when the loop will end. So if we run this code four loop will work from 0 to 5. But in five case, loop will end so we cannot see the eye values after four because the five value of I will not execute message box shows his numbers from 0 to 4. The break statement comes in very handy at this point, and now the other statements continue. Continue. So this statement is used to skip over the execution part of the loop on a certain condition, and then after that it transfers a control to the beginning of the loop. So basically it's Gibbs. It's following statements and continues with the next generation of the loop. So in the following schema, as you see here after the continue, the compiler runs the loop control statement, and that's how we use it in code. So we run this code, you will see numbers from 0 to 9 except five because five is value of I, and it will not execute. The other statement is that go to so go to is the statement that's used to transfer control to the label statement in the program. The label is the valid identify air and is placed just before the statement from where the control is transferred. In the following scheme up, you can see the go to working structure and, as you can see ah, go to runs code with labelled text and let's have a look into the go to Kobach. So in this code case will be three. So the message text will be that you entered three but after to go to case will be too. So message text will be that you entered too a message box. We will see that you entered too. Now let's see these three statements and visual studio So open the last new project in ad three buttons Adjust texts to break, continue and go to and we'll start with break. So create a click event. Uh, and right string I value if I equals to break, then right message box dot show I value out of the block and put a break point. Now run the program Click break button Break point is active. Now let's see it step by step by using the F 10 key. Now I equals zero. I equals one. I equals two and break runs and the loop was ended. Press F five And as you can see, the message box shows us 01 because for the other values that code was not executed. If we change too before and run, what you see is the message box showing us 0123 Now let's do an example with Continue. So copy this code. Great click event of the continue button. Now paste change if valued to one and break to continue. Put in a break point now Run! Quick, continue. Break point is active. Now let's see it step by step with 10. Now I equals zero code was executed. Now I equals one condition is true. Continue As you see, the compiler went to the four condition without running the following coat and go on. I equals two Now I value line was executed. Press F five. As you can see, the message box shows us numbers from 0 to 4 except one, not change 123 and run the program again. Press F five. As you can see this time, the message box shows us numbers from 0 to 4 except three. And that's how the continue statement works. So let's make an example with goat. Create click event of the go to button. And now right this switch with me but a break point. And now run the program. Number of value is three. So case three was executed. Now go to statement. As you see, the compiler runs case too now RSF 10. And what do you see? The message box shows us that you entered too Great. So that wraps it up for this section. This video was learning all about jump statements in the next lesson, we will. Well, you know what I think it's time to create a project by using and putting together everything that we've learned. What do you think? Perfect. Ammen do see you then. 36. Project: Hello, my dear friends. So in this section we will develop a project so that we can see all that we've learned together. It's gonna be fun on this project. We will sort the divisible numbers according to the options that we want. So let's make it step by step. First opened up a new project that's called counting. And now that the project is open ah, let us adjust the form properties. So changed the text to counting numbers and a just a start position. Do the center screen. Now. I had a label. Just adjust the labels properties. So label one change starts from Texas 12 Bold and now at another label. If you want, you just copy all the elements just by pressing the control and then drag the element. As you can see, we copy the label. So now James a text to to Okay, so now at a text box to your form and well adjusted text size, let's make it 12 points. And the name is we have learned txt start from and now just copying and adjust the name text to No, I had a button and will make that name be tiene count. Text size. 12 Bold text count. Okay, good. So now you can just copy it and adjust the new button to extend it and the name button exit . No, let's great. Some events for this button first create the exit buttons event and right in the event application dot Exit. Now run. So when we click the exit button, the application will close in. As you can see, the application is now closed. Bravo. Now let's go on Create count buttons Event. So first defined to end value for this text box and first number equals zero and last number equals zero. Right first number equals convert. End 32 txt start from and last number equals convert and 32 text to Message box and let's Enderson values. So click count. And as you can see, we get the values from the text box. Okay, so now let's go on. So we need a combo box com a box that we're going to be able to choose a divisible number that the program will count. So first copy a label and will change the text to divisible number. Then add a combo box. Adjust the size to Let's say 12 points. Name CMB divisible term. And if you want, you can add values from here. I'm going to do it from the form page load, Double click So that you can get to the form. No, right. CMB divisible term dot item Add to now copy and paste change values. So now we need an invariable for holding this value. So now define it like int divisible term equals one. Great. A selected index changed event of combo box divisible term equals convert to end 32 C m b divisible term selected value and just the message box so that we can see the combo box action. Now run. Change the combo box value and click the button So as you can see divisible too from 12 to 100 or select five. And as you see, the divisible term was changed. So now let's see some divisible numbers in a text box. So anna, text box, adjust multi line property to be true name text divisible numbers. That must be long so that we can show all the number. So let's write some code. And as you can see in the message box, we have a combo box Selected value first number and last number first for recur Asian. We will need a loop. So for this program, the best one, I think. And I'm sure you do too is the four loop right? Four and then press tab two times. And as you can see, the four loop was created. So let's change this first number. I we'll start from first number and let's change the last number. So now we need a condition to know which numbers are divisible for the divisible term, and we're going to use an if statement. So first we'll need a string variable toe hold the true numbers string divisible number. If we define this variable in loop, it will always change when the loop is running. Right. So if I percentage divisible term equals zero divisible number plus equals I so then this code will hold true numbers to write to the text box End of the loop. So now, right, the result on the text box text divisible number taxed equals divisible number. And now let's run it 12 50 Select five. Now click. As you can see, the numbers were written in the text box, so now has change numbers one and 2000 select five click. And as you can see, we cannot see all of the numbers together. We can go on from the next line after every 10 numbers. But guess what? For this, we will need a variable in control. Number equals zero, and we need another condition into the condition now, right? If controlled number percentage PIN equals zero divisible number plus equals environment, New line. And then, of course, we must increments the control number. Now let's run it again. And as you can see here in each line, there is 10 numbers. Great. So now let's go on. So some users may write letters in a text box, or they can just make a blank text box or might not even select any divisible term. So these states are program will given error, so let's try it out. So first select five from the Kama Box and click. And as you can see, the program crashed. So before an action, we've got to control our elements. If the text boxes empty, we've got to Oh, let's just give a warning to the user. Okay, so let's write it in here? Yes. Text start from text is empty or text to text is empty. Message box, please fill the necessary fields Else run codes. Okay, so now we're in the program. Quick count. Okay, so that makes the program not crash. But he didn't run the codes, did you? Notice S s. We have toe fill in the text box 100 Select five, click. And the program is running. Excellent. Excellent. Okay, so we fix the text box from now, we gotta fix the combo box. Don't you think so? If you don't choose anything in the combo box combo box selected index stays minus one, so we can control it else. If CMB divisible term selected index equals minus one message box show, please select divisible term now running and click the button. As you see the first control fields, fill them and click. And as you can see, the programme tells his to selected divisible term. That's ah, just It's like four. Now click and the program runs nice. So now we just have to make sure that user will select numbers instead of letters or any other characters. So we will use the text box, keep precedent. Now, if we write this code in this event for each text box in this code, we will be able to control that. Key is number run, and now I cannot write any letter. But I can write numbers access. So now it's at a radio button group for choosing the four color had a group box, adjust the group box text color. Just select it and bold, and we'll make the size 10 and four radio buttons in a group box. Now we'll adjust the name and text and, of course, with radio buttons, you could only choose one. So we've got to control that and we have to write some code in the checked change of each one. So first, create RB Black Checked change event, right? If RB Black check and we have to make the others false RB Red phones, RB, Blue Falls, RB, Green Falls And yes, we have to apply the same process to the others. - So now let's run the program. And as you can see on Lee, one of them we can choose at a time. Nice. So with this radio button, we will be able to control the four color of the text box. And now we have to control the text color in the radio buttons checked. Change event, right. Text divisible number four color equals color black and apply it to the others. Now run Phil Fields and click. As you can see now the text is red, blue, green, black. All right, we're on a roll now, so let's add a check box for bold and italics properties at a check box. Name C h Bold. Bold. Now copy the just name C h italics and create a checked change event. Uh, for bold now, right? If ch bold check a just bold else font style will be regular and apply this to the italic check box. Now we're on the program And what we see Bold, regular, bold, regular or metallic regular metallic regular and exit so you can control all the elements of the index together with tab order. Now we're on the program, so that's fantastic. So, um, this is a project that we just, you know, made to practice toe, be able to use the elements, conditions and loops altogether. If you want, you can go on and develop it because there's a lot of opportunity for you here. Uh, there's always room for practice. Right In the next section, we will examine a raise. See you there. 37. 36 Arrays: Hello, dear friends. So in this video, we will examine a raise. So why don't we begin? So we've learned already that a variable can hold on Lee One literal value, for example. And string name equals John. Only one literal value can be assigned to a variable. So supposing that you wanna know store 100 different values, then it would be pretty cumbersome, I think, to create 100 different variables, right? So how do you overcome this problem? We use a ray. An array is a special type of data type which can store fixed number of values sequentially using special syntax. So the following image here shows how it array stores value sequentially, As you can see in the figure above, the index is a number starting from zero, which stores the value you can store. A fixed number of values in an array and rate index will be increased by one sequentially until the maximum specified array size. Now an array is defined. Like this data type is used to specify the type of elements in the array specifies the size of the rain, and the name specifies, then name of the rain. So let's see, For example, the following are different ways of declaring an array with different data types. You can also use a raise like I'll set up here now. In the 1st 1 we only talked about ah, size two numbers array, right and the other array. We defined array and put a raise as elements. So in the numbers array will assign values like this, or you can take a value from an array like this. So if we use it as a code block, do it like this and we can see inside the text box all the days Inn array. Now, as I may have said before, we can also use a four each loop with a raise. I'm sure you remember that I was going to talk about it, and here we are. So the following code shows us how we can use the for each loop with a rain. Now I'll point out, too, that these rays are one dimensional raise. You could also use multi dimensional raise. The multi dimensional ray contains more than one row to store the values. It's also known as a rectangular array in C sharp because it's each row length is the same , so it can be Ah two D array or a three D array, or even more now, to be able to store and access the values of the array. We require the nested loop, so the multi dimensional array, declaration initialization and accessing is just as follows. This array has five rows and four columns and array. Three D has three dimensions. Five four tree. We can define an array like this, so if you want to access these array values, you must use a nested loop as we've got here in the following coat. Now, before we move on to the visual studio, we really do have to learn a new element in dot net and it's named data grid view. Sounds like it'll come in handy, huh? Data grid view. So displaying data in a tabular format is a task that you're likely to perform quite frequently. The data grid view control is designed to be a complete solution for displaying tabular data with Windows forms. The data grid view control is highly configurable and extensible data grid view has a lot of properties, but for now will just use it to show our array you can play around later, so let's just see a raise in Visual studio Open up. Visual studio created new project at a button and a data grid view now change but named too . DTN show and text to show now create a click event. So first, let's see the array declare String days Now we declared an array for Define. We have to give the size, so let's give size seven. Now we will give days to the array, so we have to write days zero Sunday days, one Monday and so on. Okay, so now let's show this array in data grid view. First, we have to add a column to data grid view like this name. The days now, right. Four length of days. We have two and a row to the data grid view. String row text equals days. I data grid view rose and road text. Now run. And as you can see in grid view, we can see weekdays. Okay, so now let's make a multi dimensional ray and a new button name. B TN multi array text Multi array. Now create a click event right This array with me. Now add a new column to the data grid view. Now let's write a nested loop to show this data in data grid view. Now, write the code with me, and this flu is to access rose in the ray. This loop is to access columns and so on. So now let's run the program. And as you can see, grid view shows multi dimensional race well done. So in this video, we've learned to raise the next video. We're gonna learn the methods, and I know you're looking forward to that. I'll see you there. 38. Methods: Hello, my friends. We are going to examine methods just like I promised you in this video. So why don't we get right to it? So methods are generally the block of codes or statements in a program that gives the user the ability to reuse the same code, which ultimately saves the excessive use of memory. And it acts as a time saver, and much more importantly, it provides a better readability of the code. So basically, Method is a collection of statements that perform some specific tasks and then return that result to the caller. Now, a method could also perform some specific task without returning anything. Um, but let's have ah, look at the methods structure and then we'll break it down. Access modifier, return type, method, name, parameter list and method operations access modifier. So it defines the access type of the method. Um, in other words, from where it can be accessed within your application makes sense N. C. Sharp. There are public protected and private access modifiers, but for now we're just going to focus on the public and private, and in the following steps we will learn the differences between public and private return time. It defines the data type returned by the method. So depends upon the user, because it could also return. Avoid value, which is another way of saying it returns bupkis, which is another way of saying it returns nothing right. Method name. So the method name is a unique identify rare, and it is indeed case sensitive. It cannot be the same as any other identify are declared in the class. And that's what I mean by unique. So parameter list. Comma separated list of the input parameters are defined, proceeded with their data type within the enclosed parenthesis. If there are no parameters than empty parentheses, have to be used and method operations. So it just includes whatever we want to do with this particular method, so we can define a method like this in this method, Public is the access modifier and is a return time. Get length is the method Name. Paragraph is parameter why we should use methods So there are many advantages to using methods a few of them include. It makes the program well structured. Methods enhanced the readability of the code. It provides an effective way for the user to reuse the existing code. It also optimizes the execution time in memory space. Now, before we go on and learn all the method types we have to learn What is the difference between public and private? You might assume. But I'm gonna take you through it anyway. Methods can, Like I said before, have re access modifiers public crime in and protected. We'll examine the protected in the following trainings with object oriented programming. But right now we're just gonna learn about public and private and how they differ so private. If you choose private to be the excess modifier, it means that you can only use this method in this class in another class you just cannot access. This method makes sense right public. If you choose this modifier, it means that you can use this method in every class of your project. Alrighty. Then we can examine methods in five classes without parameters in return type methods with parameters and without return time without parameters and with return time with the parameter and return type static methods. So methods which created without parameters and return type methods, as as you might be able to ascertain this method has no parameters or return time. You can define him like this, methods that are created with parameter and without return type, so you can see that this method has parameters but not a return type. You define him like this. So what about methods that are created without parameter and with a return type? Let's have a look at this, so this method is no parameters, but it does have a return time to find him like this. And now you can see that these methods have parameters and return type. So if your method has a return time, then you must use return of value in the defined type. So let's have a look at that. The methods that are created with parameter and return time, and this is the method that has parameters and return time. So define him like this. Let's have a look at static methods, static methods or methods that are called on the class itself, so it's not on a specific object. Instance. The static modifier ensures implementation is the same across all class instances now in other languages, thes air known as class methods. As you can see here in this code, passing parameters to methods now. Supposing if we want to create a method with parameters, then we need to pass a parameter to that method while calling it in our application. So we have, ah, a couple of different ways to pass parameters to the method and let's have a look. Value parameters don't put parameter reference parameters, so value parameters. They're also called input parameters, and these parameters will pass a copy the the original value instead of the original parameter. So the changes made to the parameters in the called method will not have an effect on the original values. When the controlled returns to the caller makes sense output parameters. So these air called output parameters because they are more like a reference type of parameter. But the only difference is that we don't need to initialize it before passing reference parameters. They're also called input output parameters, and these will pass ah memory reference of the original parameters. So the changes made to the parameters in the called method will have an effect on the original values. When controlled returns to the caller a method overloading allows the creation of several methods with the same name, which differ from each other in the type of input. Okay, so, for example, these tree method have the same name but different parameters. Now, if we don't send any parameter, the first method will work. And if we send one parameter, the second method will work. If we send two parameters, the third method will work. And that's why we call this structure method overloading. So what do you say we hop on over a visual studio and have a look? So open up a new project with the name method and now at a group box to the form and a tree radio button in the group box that label do text boxes and a button. Okay, so now create the buttons, click events. And now we will create the function and we will use them in the buttons one by one. So we first examine methods which have no parameters in return time. For example, public hide radio buttons Now write it in the method who box visible phones. So the use of this method is just like that. Hide radio buttons and now run, create the button. And what do you see? Our method has worked, so we'll move on and write another one. Public void. Clear all texts. Text box one Queer text box to clear now Call this method in a click event. Clear all texts now run. Write something in the text boxes like and the tax boxes. They're all clear now. The other method, which has parameters but does not have a return time. Let's Ah, let's write a new method public. And by the way, you don't have to write public or private. If you don't write anything, the program will default to private, so right void Fill text box. This method will move the text from the text box one to text box to so call with a button click and we'll write something in the text box. One click. And as you can see, the Texas moved. Okay, so let's do another method. Create set number like the one text You are age years old. Now call, run, click and what do you know? Our method worked, says right. Another method, which has no parameters but has a return type string Get name. String name name equals Charles Return name. Now call it in the button and click string name equals get name, message, box show, name, run. And what do you see? The message box shows us the name, so let's do another one. This is method which has a parameter and a return time create and some end X and why? And result equals X plus. Why? Return result. Call it in and click and result equals message Box show, result Run 12 25 Click. And what do you see? The message box gives this 37. All right, So now are you ready for an example with overloading? So let's write these re methods just right along with me. Now put three break points on the methods. Okay, so now let's try it. One by one will first write string name equals value control. Right? And what do we see? Do you see that this brake point is active and the program is executing the method So now and John and run and the second method was executed and true Run. And what do you know? The third method was executed message box show name. So now let's remove the break points and put a break point here. Now start repress the F 10. The compiler will go to the next line, as you see. Now, try it again. If we press f 11 and what do you know? What do you see there? So while using a break point, if we press f 11 we will go to the method or function. Cool. So you know what? That's enough for now for methods. Because we really do want to get into the examination of classes, so I'm going to see it in the next video. 39. Class: Hello, my dear friends, I promise to see you and I'm looking right at you. This video we will examine classes. So cover of the camera and let's get started. So what is class and object? I'll tell you that classes are the most important element of object oriented programming because it's thanks to the classes. The programs are divided into parts and the complexity is reduced. Um, the created methods and the properties air contained within a class. And we can always reuse a class. So in a class, both functions and data are closely linked at the same time, so class must contain a number of members for the objects to be created in right. So these members fields, methods, constructors, properties, events, delegates, all that kind of stuff. Now the class serves as a You can think of it as a template for objects. That is. The class defines the operations and properties associated with the states of the objects. Data and procedures for objects with common properties are collected in a class. Then objects are defined in the program using this class structure. So generally, ah, class declaration contains Onley, a keyword class followed by an identify roar name of the class. But there are also some optional attributes, which can be used with class declaration. According to the applications requirement, the class is a user defined blueprint or prototype from which objects are created. That makes sense. Yeah, so basically, a class combines the fields and the methods into a single unit in C Sharp Classes support polymorphism inheritance and also provides the concept of derived classes as well as base classes. But we will be examining them in object oriented programming that we can define A class like this code does class employees now an object in object oriented programming. Objects are generated from classes. So unlike classes, objects are, I'd say alive and have identities. So the properties of two objects of the same class are similar, right? But the properties may vary, so this code shows us the use of an object. Here. Employee is class. Personal detail is object, so class has fields and properties. So what is property and feel? The field has to be declared in a type class were structure with its data type and unidentified air that names the member. They can also be specified with attributes and modifiers such as new access modifier remember public, private protected or internal static read only and volatile during its declaration. Now it may also be assigned an initial value. For example, the personal details of an employee class like name designation etcetera can be stored as an instance field to store the values off each employee. Object says. You see in this code employee I D and name our fields. Properties are the special type of class members that provides a flexible mechanism in order to read and write or compute the value of a private field. Properties can be used as if they are public data members, but they're actually special methods called Access er's. So this enables data to be accessed easily, and it helps to promote the flexibility and safety of methods. Encapsulation and hiding of information can also be achieved using properties, so it uses pre defined methods which are get and set. So these air the methods which helped to excess and modify the properties. So in this class, age is a property and it has two methods get and set. So what are get and set methods? No, I'm not reading your mind I told you to cover that camera anyway, get and said or the methods that we use to access properties get method gives us object properties value. And the set method is an assigning method so we can assign a value to this property with the set method. Now, if we defined the employee class like this and we can use this class in another place like this and that's how they getting set methods work. So what about defining methods in classes? So we have made this in methods. There's no difference for defining it. The difference is the use of methods. So if we define a method like this, then the access modifiers public so we can access this method from everywhere and within our application. So now we can use this method like this. All right, so now we have enough information s so that we can use classes in our upcoming videos and we're gonna tell you a little bit more information about classes and object oriented programming. But for now, let's see some examples in visual studio, So create a new project name learning classes. Okay, so now we have a form. The form is already a class, but what we're gonna do is at a new one. So in solution Explorer, right click and select New item. Choose class. Um, the name is employees. Now we created a class. So first we'll need to set up some properties. So let's add public and employee, I d get said. And if you want, you can use props like this. Now if you write prop and press the tab key twice, you can see that a property will be created. Change name and type string prop tab tab Change name age. Now let's go to the other form. Add two buttons. Change the text of button one to get values, then change the other one set values. Now we will add a tree text box to our form. Change names text employee I D. Text name, text age. Now let's set values to object and now create click event to set button. So first we have to create a new object from the employee class employees person detail new employees, and now we have created our object right personal detail dot And as you can see, we see the I d. The name of the age in this window employee I d equals text employee I d. Taxed now, as you see and error has been thrown because we defined employee I d. End. So we've got to convert to Ent Convert to end 32. Now go on and the message box looks like all the date has been received at a break point. Now run. And what do you know? We can see all the values. So now let's get data from an object in another form, add new form to project. Now add labels and text boxes and adjust names. And then we need to define an object from the employee class. Public personal detail equals new employees now, right, Inform load text box text, personal detail, employee I D and let's go on. So then we have to send this value to the other form and new button name, button send and text sin. So copy this part and paste it in. Click event from two f r. M equals new form to f r m dot personal detail equals personal detail. If our M show dialogue now run 90 12 named Charles age 35 send And what do you know we made a little lap with an employee class. So in visual studio, there many classes. Now, in this training, we will examine and make, I don't know, another couple of little applications with blissed class, random class math class and timer class. In the next video, we will examine the list class. See you then. 40. List Class: Hello, everybody. In this video, we will examine the list class, so let's begin. The list class represents the list of objects which can be accessed by index. It comes under this system collection. Generic name space with glass can be used to create a collection of different types, like integers strings. Or you can add an object in a list list. Glass also provides a methods to search, sort and manipulate lists. You can define lists like this, or you can make an object list like this. So list is different from a raise. A list can be resized dynamically, but a raise cannot. This glass can accept no as a valid value for reference times, and it also allows duplicate elements. If the count becomes equal to capacity than the capacity of the list increases automatically by reallocating the internal array, the existing elements will be copied to the new array before the addition of the new element list. Class is the generic equivalent of a ray list class. By implementing the list generic interface, this glass can use both equality and ordering. Compare ER this class is not sorted by default and elements are accessed by zero based index for very large list objects. You can increase the maximum capacity to two billion elements on a 64 bit system by setting the enabled attributes of the configuration element to true in the run time environment. This glass handsome properties we can access, capacity count and an item of with. Also, there are some methods that we can add or remove an element. Also, you can clear all this. You can sort list etcetera. We can use them like this. And, as you see weekend add, remove an object to list like this and dot Net. We usually use list for filling a combo box list box or data grid view from a database. So theoretically, I think that's ah, enough about lists. For now. When we see this in Visual Studio, let's create a new project named List or List using or list new or my list. Whatever you want now is the finalist for integers list. End number list equals new list end or a string list list. String text list equals new list string. Now let's add some items by using the ad in a method. First, create a method name Phil List number list dot and one number live. Add to number list. Add three. If we call this method, we will add three items to the list now at a button name. Feel list now call Method Message box show list was filled, but a break point now run and quick button break point is active. If you look in list like this, you can see you list elements. Now let's show them in a text box, added text box and just properties. Now we can use for each statement for less like a rain for each item in number list. Now in this loop item is our element. Text number plus equals item to string environment, New line Now run and quick button. And as you see, we can see all the elements in the text box. Now let's change the values and a new class name. Employees and Properties I. D. Name and surname. Now let's add objects to a new list. Create a new list name employee list new create an object from employees, employees, employees. One equals new employees. Now let's fill properties. Employees one dot i d equals one employees. One name Charles Employees. One surname, Dickins Now let's add new objects. Now let's move them in a method Public list Employees fill list. Return employee list. It's done. Let's fill them to text box. First Call method for each item in employee list. Text equals item dot i dy plus item name plus item, surname plus environment. New Line. Now it is done. So that's running quick button. And as you can see, we can see all the elements in the text box. No, it's fill a combo box with list. So first create a new class class days proper I d prop string taxed value. No, Let's create a new list. Ah, named combo list. Now add some element to list days. They won equals new days. Day one I d equals one. They won name Sunday combo list and day one Now copy for every day. - If you want to, you can add a new object to list like this. Okay, so that is done. So let's show days in combo box at a combo box name CMB days. Now we have to give a data source to the combo box. Now we have to define display and value member CMB days dot Value member i d CMB days dot display member equals text value. Now in combo box, we will see names, but when we get selected item we will take the i d parameter. So let's see and combo box selected index changed Message box shows CMB days dot selected item to string. Now run as you see in combo box Weaken See day names. But if we select Monday, as you see, message box shows us too, because Monday's I D is too right. That's enough for the combo box. Let's fill a data grid view with data list at a data grid. Viewed name days now. For this, you only have to give a data source to data grid view. Now run. And as you see, data grid view was filled. All right, so now we have learned the list using the following videos. We will use them for the database operations. It's on the next video. We will examine random class in C sharp. I'll see in the next video 41. Random Class : Hello, my dear friends. So this video, we will examine the random class just like a promise. And we're gonna do up an example with the random class. So let's begin. So what do you know? The random class of C sharp can be used for creating practical things like usable random numbers like a password generator. Now, a few main points about the random class are as follows. The random class represents as pseudo number generator. A mathematical algorithm is used for generating a random number. Basically, ah, random class uses the modified version of the Donald E knew this subtracted random number generator algorithm. You can look that up if you want to, or you could just trust me. You may use the random class after, including the reference for the system name space. So the random class has tree methods. Next, next double and next bites. First we'll start with the next method so we can use next method with tree in different ways, as you can see and we can use like this now if we use the 1st 1 the program will give us a number in numbers from zero to capacity of Intertype range so if we give a parameter to the next, then we will have to give a max value of the range that makes sense for the second. Next, our number range is from 0 to 100. And if we're gonna give two parameters, then we define the first in the last number of our range for the third. Next are ranges from 10 to 100 on. The next method returns us and energy value. So then the other one is the next double Emmis method gives us a double number, which ranges from 0 to 1. And we typically use this method like this and the last one is next bites. So this method returns a bite array, and we can use it like this that with next bites, we can We can also use more than one number. Together we can choose the number amount with the or a size. And you know what? That's all there is to the random class. So let's see it in visual studio. So open up visual studio and create a new project and call it Name is, uh, I don't know, random or using random. Whatever you want. First at a label on a button. James Name button. Random and text. Random Now Creative ven. And now let's take a number. Random RND equals new random random object label Taxed RND Point Next run program and what do you see? It gives us a number. Now let's set the max size to 100 run, and now our number is going to be smaller than 100 now, right, men size 90 and the program will give us a number from 90 to 100 Now, what do you know? If you do need more than one number, you will have to write new next. Or you might have already thought of this. Use a loop. So let's and four new labels and right the Coke change range. Just 1 to 10. Now add label, too. And let's go on. When we were on the program, the numbers may be the same because every random creation is going to be created again. So this maybe it's OK if you want. We can control it, though with conditions. Now run the program and what do you know? We have five numbers and what do you see? The same numbers. So if we want. We can change the last number with a float. So if we change it with next double now run. Look at that. The last number is different, all right, so if you need more than one number than you have, you've gotta use next bites. So let's change what we got to five labels and define an array, then has a size of five. Now get values from the array label. One text equals array. Zero. Go on, go on now on the program and as you see our labels or changing value types or bite. So number ranges from 0 to 999 with this method. Now if you want, because I know what you want. But I do want to show you that we can also create string values. So let's add a new button change tax to password, and we will create a password, which has no six digits. So first will need characters, and all I'll do is just added with copy and paste. Of course, you can always grab it with a string list. So right this code, and that creates a six character length password label text result now run And what do you know? Where you have a string password? Cool. So that's all the fun we're gonna have with a random class. For now, in the next section, we're going to examine the timer class, so I'll see in the next video. 42. Timer Class: timer class. Hello, dear friends who in this video we will examine the timer class, and I will make some examples with the timer class, so let's just begin. So the timer in C sharp executes a block of code repeatedly at a given interval of time. Execution occurs via a timer event. So, for example, let's say you know you want to back up a folder every 10 minutes or right log file every second. The method that needs to be executed is placed inside the event of the timer. So the timer class and see sharp represents a timer. Windows forms also has a timer control that can be dropped into a form and its property set . So a timer has properties as well as events. And you know what? We can just go ahead and have a look and visual studio. So open up, visual studio, create a new project. Let's call it, um, timer, Dragon timer into your form. And now run. And what do you see? A timer Control does not have a visual representation, so it works like a component in the background. So what do we need? Let's examine that timer object. The first property is interval. So this property controls when the timer tick will be activated. The value of the interval property is in milliseconds. So if you want Ah, let's say five seconds. You've got to write 5000 to the interval and enabled because you want this property to control which codes are in the timer tick, whether it be run or not, start and stop. And of course, you wanted to start the start. Property starts the timer running and the stop ends it. So if we do wanna use the timer, we've got a started before we wanted to start, right? The timer has only one event, and that is timer tick. So if you write 3000 and the Interval Properties, it means that the timer tech will run each and every three seconds. Is that clear? Now, let's, uh, a little project with our timer class. Now add two buttons for a start and a stop timer, and we'll adjust the button names and a label to take that timer value. Now, let's had a progress bar. Just right. Click Event of the start timer. One start and this one stop now created tick event and right message box show timer value. Okay, so the interval is 100. Change it to 1000. Now start. Okay, So what we're looking at is for every second of message boxes created. So now just stop it with in visual studio. Now, let's have a look at the Progress Bar. So first, you've got to know that the Progress Bar has a max value. So we've got to change it to 60 for a minute, and then we need a counter. Ah, to give that progress bar and counter zero progress, value equals counter, counter plus plus. Now start. And you can see the Progress bar working. Now we need a countdown timer. So change the value of the counter to 60 and run. Change. Interval 10. See the end. Run. And as you can see, the program crashed. Why? Because a progress bar came to its limit. So we've got to control it. That's right. A condition. If counter equals zero, then stop timer. Message box timer. Stop now. Right. And there's no error, so we can use the timer for a message button. Um, you know, toe, grab some attention. Hey, look at me. We can use the timer for ah, changing the back color of a message button. But we also need a condition. So let's say, for an example, uh, every second the back color changes red toe white men after that, white to red, see where I'm going with it. So first, let's had a button change. The text message and the back color white. Now right in the time, Click back color red else white now star. And as you can see, the buttons back, color is changing for each second. Now, if you want, you can take seconds or split seconds in this section. That's how we use the timer class. Next section. We're going to use the math class, so stay tuned for math class I'll see in the next video. 43. Math Class: math class. No, my dear friends, in this video, we will get into down and dirty with the math class. Now, it's not gonna be like any math class you've ever encountered before because right out of the gate, we're gonna just start with an example. So you ready? Math class offers many constant fields and static methods that you can use to do Trigana metric of log arrhythmic and other mathematical calculations. Right? So the math class has a lot of methods that we cannot examine all of them, of course. So we'll just talk about a few of them and we will examine the methods in a table. And as you can see in this table, men as two decimal parameters and returns, the smaller of the two decimal numbers max as two decimal parameters and returns the larger of the two decimal numbers ABS takes ah decimal parameter returns the absolute value of a decimal number sign takes a decimal parameter and returns an imager that indicates the sign of a decimal number sign or s i n sin takes a double parameter returns this sign of the specified angle cause See us co sign. Guess what it takes a double parameter and returns the co sign of this best fight angle pan takes a double parameter and return to the tangent of the specified angle. Pal takes two double parameters and returns a specified number Raise to the specific or specified power squirt takes a double parameter returns the square root of a specified number. Next. Just doesn't have the same ring as e x. P does it anyway. It takes a double parameter and returns e raised to the specifying power exponents log takes two double parameters and returns the log a rhythm of a specified number in a specified base. Okay, so now I promised you an example. Here it iss We're gonna make a calculator using these methods. So open up visual studio and create a new project. We'll call it calculator. Okay, so first, we're going to design the calculator, so we'll need a group box, three text boxes and buttons. All right, so now I will adjust the names and texts. So now we have to adjust the result. Text boxes read only property to be true. So first we have to adjust that only the text box number properties so we will use keep precedence for the first number and second number. If you remember, we made this in the previous project. - Now we will call methods in necessary button events. But first we need to method to get the text boxes values. So let's right set one parameter said to parameter. And we will write this code s so that we can use it in the necessary button. - And now we will write the buttons. Click one by one first see button will clear all text now run cool. So let's test and see. There's no problem there. Men Button will give us math men method. This method takes two decimal parameters like we said before, so we will call set two parameters method. So in this method, first we have to control the necessary text box value. If any text box is empty, the program will give us a message box and we have to convert values to decimal and a sign return value to the result. Tanks now run cool. So let's test and what do you know? The button controls. That text box is empty and we can see the result in the result text box So now I will write them one by one Max and see. There's no problem there now. You must control every button after you write the codes. Otherwise you could make a mistake. EMS see Everything's OK. Sign. - See ? Everything's OK. Sign. - See ? Everything's OK. Go sign and you can copy and paste codes. But I don't advise it for this. - See ? Everything's OK. Tangent See ? Everything's OK. How? - See ? Everything's OK, Squirt. - See ? Everything's OK. Log See ? Everything's OK. Log 10. - See ? Everything's OK. E X p See ? Everything's OK. Copy the first number So we'll use it when we may want to use a result in our calculate process We will assign result to the first number. See, there's no problem there. So now we finished a calculator. 01 last thing. We have to adjust the tab Order So view Tab Order and I'll click the elements one by one. That's all. What do you think? So we've now finished this particular training. I hope to see you on the next course. Until then, keep programming