Basic C# Programming for Beginners | Ionescu Doru | Skillshare

Basic C# Programming for Beginners

Ionescu Doru

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
42 Lessons (7h 53m)
    • 1. Introduction

      1:50
    • 2. Installing Visual Studio Community for Windows Desktop

      2:19
    • 3. Creating Your First C# Program

      1:53
    • 4. About C# Environment

      1:20
    • 5. Events for mouse & keyboard + GUI

      6:06
    • 6. Simple paint with mouse events

      6:34
    • 7. Paint editor with different controls mouse events

      13:14
    • 8. Third application with mouse events (Part 1)

      14:29
    • 9. Third application with mouse events (Part 2)

      9:49
    • 10. Simple application with keyboard controls

      4:51
    • 11. Make a piano application using keyboard or mouse events (Part 1)

      19:12
    • 12. Make a piano application using keyboard or mouse events (Part 2)

      15:45
    • 13. Exceptions Handling (Part 1)

      4:10
    • 14. Exception Handling # (Part 2)

      19:02
    • 15. Exception Handling # (Part 3)

      2:38
    • 16. Exception Handling # (Part 4)

      17:17
    • 17. Exception Handling # (Part 5)

      8:10
    • 18. Calculate Interest Rate

      13:27
    • 19. Files and XML Files

      5:58
    • 20. Add, View, Delete Student from File (Part 1)

      18:21
    • 21. Add, View, Delete Student from File (Part 2)

      4:12
    • 22. Add & Modify Rows in a Listview and Save the fields to a file

      17:53
    • 23. Application XML Basics (Part 1)

      12:28
    • 24. Working with XML Files (Part 2)

      9:53
    • 25. Load, Read, Save Student in XML File Application

      15:36
    • 26. Parse, Generate, View, Save & Open Xml File App (Part 1)

      16:15
    • 27. Parse, Generate, View, Save & Open Xml File App (Part 2)

      5:53
    • 28. Slideshow Images App

      19:40
    • 29. Listview and Treeview

      3:24
    • 30. Listview Controls (Part 1)

      19:29
    • 31. ListView Controls (Part 2)

      16:44
    • 32. Controls TreeView App

      15:27
    • 33. Listview Insert Products

      19:52
    • 34. ListView Insert Books (Part 1)

      17:31
    • 35. ListView Insert Books (Part 2)

      9:14
    • 36. Add & Remove & Visualize Records

      19:43
    • 37. Insert Records ListView

      8:31
    • 38. Listview Show file types details (Part 1)

      16:27
    • 39. Listview Show file types details (Part 2)

      10:20
    • 40. Treeview Show file types details (Part 1)

      16:07
    • 41. Treeview Show file types details (Part 2)

      10:57
    • 42. Conclusion

      1:26

About This Class

Welcome to my class. Here, I will brake down complex concepts into easy-to-follow steps to ensure that you can easily learn the C# language, even if you have never coded before.


I've carefully chosen the topics to give you a broad exposure to C#, while not overwhelming you with too much information at once. It includes object-oriented programming concepts, error handling techniques, file handling techniquesand much more.


With this class, you will learn C# fast. Concepts will be presented in a “to-the-point” style to cater to the busy individual.

By the end of this class, you will:

  • Create mouse and keyboard applications and a bonus application building a piano that play songs automatically;
  • Create ways to treat errors without crush into the middle of the application;
  • Create, Add, Modify, Remove, Save, Open, Encode, Decode Files;
  • Understand the file formats and how to work with processes to open different programs inside a ListView / TreeView;
  • Create ListView / TreeView applications that are easy to understand, destined for beginners;
  • Bonus applications where you will discover how simple is to transform ideas into practical applications using the great language C#.

Transcripts

1. Introduction: Hi. My name is Eunice Cordaro and I will be your instructor for programming Windows applications for the stock in C. Sharp Cars and I will teach you how to create fast in smart applications with little effort . The main chapters in this cars are Chapter one mouse and keyboard events. In this chapter, we're going to build a paint editor that we can save what we draw on the form using mouse events on application, explaining the main keyboard contra owes and the piano application as a Boehner's that use most in keyboard events in which we learn how to make songs because we have the tools we need The notes. Chapter two exceptions handling. In this chapter, we learn how to understand the try catch. Finally, blocks treat errors went appear what the generate exceptions and said them. Resolve the errors and create error providers. Chapter free takes files in XML files. In this chapter, we learn how toe insert, modify and remove records from text files. Then we read bars and extract the data from the XML files and chapter for lease view and three view controls in this chapter will define the structure for inserting records inside the least view and review change the type off formats for files in a variety off applications 2. Installing Visual Studio Community for Windows Desktop: hello in this lecture will. Don't note the Visual Studio Community 2015 and install it to get started. Navigate in your browser toe visual studio dot com, then press on the downloads stub all downloads. Then we see the old versions I have installed on my computer visual studio community 2013. But the latest is Visual Studio Community 2015. First we select the visual studio community 2015. Then we'll go and press the download button and we lunch. A small download with Onley. Few megabyte is there, and that's because he will take the rest from the Internet while is installing it. So if you're going to lunch, this installer is goingto bring the splash screen. It's gonna ask you where you want to put it. You can select the custom version, but for the purpose of the beginner, I would choose typical. After that, you're going toe hit Install, depending on how your Internet connection or how fast your computer is. This will take between 10 minutes and have off our. After the installation is finished, we will lunch the visual studio Community 2014 or 2015 and the first thing it will ask you if you want to sign in for a new account. After you create an Microsoft account, you can see in the up right corner on the start page. If you're connected to the Internet, it will give you news from the industry. A lot off new articles, probably some advanced things. 3. Creating Your First C# Program: Hello. Welcome to the first application in visual studio community 2014. In this lecture we want to print toe the form a message. Hello, world. We go to the file menu New project. We select visual seizure when those forms application and we give her name Hello world. We press OK. We wait for creating the project. We see the form that represents the canvas where we put our controls and we work with them in the 12 Oaks we see all the controls and search for but, um, we have the bottle on the form we click the right click of the mouse properties and change the name off the bottom toe Press me then we double click on the bottom and we enter on the gold source area Inside the button. One function. We want to write one line to bring a message to the form we die Message bugs not show in the string Her law watered and semi Kal, we go to the debug started the bugging We see the form in the bottom impress the bottom and we see the message. Hello, world 4. About C# Environment: hello in this lecture will add few tips and show the environment that will work with first step. If we have errors, it will specify the error on the line number. If we cut the semi colon and go start, it will appear on the output. Semicolon expected online number 22 but we don't know where 22 is. So for that we go to the tools options takes a the door. We expand C Sharp and Jake for line numbers press OK, and now we see where 22 is. Secondly, inside the form view on the toolbox we see all the controls and the properties. When we click on the Solution Explorer inside our project Hello world. We see all the files generated and we can add more classes and link them together. 5. Events for mouse & keyboard + GUI: Hello. In this lecture, we're talking about the concept that we are using inside the mouse and keyboard events applications. We begin with most events. Mouse click occurs when the control is click by the mouse. Mo's down occurs when the mouse pointer is over the control and the mouse button is pressed . Most enter occurs when the most pointer enters. The control most over occurs when the mouse pointer rests on the control. Most leave occurs when the mouse pointer leaves the control. Most move occurs when the mouse pointer is moved over the control. Most up occurs when the mouse pointer is over the control and the mountains bottom is released and mounts will occurs when the mouse will moves while the control has focused, then keyboard events Key down even occurs when a key Berkey is pressed down. G up event occurs after you release the breast G. Keep rest even triggers when a complete key press is made pressing, then releasing the key after most and keyboard events. A great place in our applications will occupy the array least class that represents on order collection off on object that can be indexed individually. It is basically on alternative array. However, unlike array, you can add and remove items from a list at the specified position using an index and the array resize is itself automatically. It also allows dynamic memory allocation, adding searching and sorting items in the list, then creating graphics object for drawing the common language. Runtime uses an advanced implementation off the Windows Graphics design interface called G I plus the GED. I Plus allows you to great graphics dro text and manipulate graphical images as objects. The graphics object represents a G d. I plus drawing surface and is the object that is used to create graphical images. The points setting the coordinates event that X an event that why the pen is usedto draw lines, curves and to outline shapes and determines the color of the brush. The client re tangle, which represents the entire form dro image droz, the specified image at the specified location and with the original size Dro line draws a line connecting the two points specified by the coordinate Paris, then graphics elements graphical user interfaces in that net and visual seizure uses event handling Macanese toe handle events that occur while the program is running events are behaviors or happenings that occur when the program is running events. Handling is the process off monitoring for certain events to occur and then executing codes when a specific event happens, when those forms use event handling to add functionality and respond with a user without even handling forms and user interfaces are pretty much useless. Graphical user interfaces allow a user to interact easily with the program, using different visual components on the early days off the computer world. Applications are text based, and you type comments in input. To make the program useful, you need to memorize a long list off comments. Toby Ableto work properly with a program. Modern software applications have graphical user interfaces. You see them in almost every program you use. Now, visual programming makes it easy for you to create graphical user interface applications by providing you a Candace where you simply drug. The controls From the toolbox controls our visual elements that compose the graphical user interface. You can interact with these controls to perform their functionality. Examples. Off controls are buttons, text boxes, labels, Jake boxes, radio buttons, it said that are that there are visual in visual. C Sharp was from the concept off visual programming. Microsoft uses the term windows forms to represent every window in an application. Visual studio allows you to create windows, forms applications easily. You can then create and design the form in the design view. 6. Simple paint with mouse events: Hello. In this lecture, we are making a simple paint application, and we explain how we take place. Free mouse events mows down, mouse up, and moms move first. As part of the design, we need to change the background color off the form in white. In order to do that, we go to the properties panel, search for back color and change the control. Do I? Secondly, we need from the toolbox a start. A strict control. We searched for starters. Three. We are toe the form with double click. We have to strip starters Rabel one. Then we pressed right click of the mouse and select view code, or simply as a shortcut F 70 and we enter on the source code area. We will need a new name, space using system that collections that will generate a non generic collection called a released class. We declare two variables inside our public class first array, least least off Boyens and the second variable bull but unsealed bone. This variable takes two values true or false, meaning that is active or not on our form. When the mouse click expressed inside our main form after the initialized component, we must set the released off points and initialize it new array list. And those so set the pencil down toe foes, meaning that is not active yet. After that, we need the events functions to be placed on the source code. We go to the form and click the event stub and such part of Moe's Down and Double Click. Then we search for most up in double click and finally, mountains move and double click. We started with the mountains down function, and we need an instance off point structure point B equal new Boeing we mama's coordinates He that acts and e that by then at the point to the array least off points. That add point, said the pencil down to true meaning that is active. When we pressed them hours and said the these that started, Streep won that items off zero. That text equal mounts down on the mouse up function. We said there pencil down to follows, meaning that is active when do not press off the mouse and said the start to strip one off items. Zero that text equal most up graphics in .net begins withdrawing lines and shapes and continues on with organ images and for marking texts. Drawing begins with a system that growing name space with the graphics class Rough eggs g equal these not create graphics method. We simply create an instance and typically called Contras Great graphics method. Creating a graphics object. Then we need the point structure. Boyens it called New Point with coordinates e that X and eat that. Why, then we need ah, pen structure. But but in Sioux Equal, New Ben, that determines the color off the line call or that's blue Violet. Then if parents still down is active, we said the status Streep one items off. Zero that next the most move then, if least off points not count greater than one, meaning if is greater than a dot. We must draw a line G that dro lying and we need the pen by unsealed the first point to connect point at least off points, off least off points that count minus one and the second point to connect points. Then we are toe the rate least off points. That odd buoyant it's then we go toe the debugging started the bugging or simply as a shortcut F five and re enter under the bugging mode. We have mouse down Mo's move. When we drove the line and most up 7. Paint editor with different controls mouse events: Hello. Welcome to the second application with most events this time we had more graphical user interface elements. We want to make a paint a bitter that we can change the color of the pencil that we draw on the form to modify the thickness off the pencil. And we want that the drawing with made Toby saved as a picture first, a spot of the design we need from the toolbox throughout the form. A Context ministry. We have it on the form. This context ministry is activated under the buggy mode. When you click on the right mouse on the form, we need free bottles inside the Context Ministry change. Color the thickness off the pass ill and save as a picture. After that, we need from the toolbox a color via log. We have the color ideologue for changing the control collar. We need ah horizontal scroll bar horizontal scroll Oberto adjust the thickness of the drawing pencil and also a label a label that keeps evidence of moving the most. After gathering all the controls to the form, we press F seven key on the keyboard and we go inside the code source. We must declare a new name space using system, not collections that will generate on a released inside the public class. We need to declare for variables private bull parents still down that the Tell us, uh, when we pressed the most or not private graphics context, creating ah graphical context, Private array, least least off points and privates. Big map image. The image that we want toe output. Then inside our public form one after initialized component, we initialize the instance for a released Mr Points. If you are released, we said the image equal new beat map and said the these that with and this not hide We said the context as graphics that from image and the image that we said and also the Horace enters crowbar, not visible it call force, meaning that is invisible at the start of the program. After creating and initialized the variables, we go to the form, context, ministry and change color with our klieg inside, we declare a color the arlo, the other g equal color diablo. We create the news. Thus, then, if the elegy that show the are log metal equal the arlo result, that okay, then these not for color the four color of the control equal the LG that collar. Then we go to the form. We double click on thickness, I only say, or the center scroll bar one that visible equal. True, we simply said the visibility to True. That means we activate the control in order to save the form in tow. Picture. We need to make a function that drove the form into a big map picture. We need to create the function. Private Avoid, say you. We need the control, see, and the string fire. We create the graphics first graphics G call see that create graphics method. Then we said the big map picture new with map and said the c dot wade and see that hide. Then we want the control that drove Tobin map that take a picture has been mapped and a new Rick dangle with four barometers. See that client rectangle that ax recorded the night? See that client rectangle that why car the night? See that with and see that hide. After that, we say picture that saved in the file the string file name. Then picture that this pose. We want to release all the resources after creating the safe function we need to go to the fore Context ministry and press double click on save button. Inside are safe button we call the function and safe with the point or these that returned the control use and the string filing that we are saving. Picture that J. Peg we need also message box, not show image was saved. Then we create the most functions we go to the form properties, events and search for most up and most move inside are most up function. We said if event mo's dot button equals most bottles that left, then we create the point B equal new point and said the court of the Knights a X is minus one and why minus one, then least off points, not add the point, said the pencil down the falls. Meaning is not active When we press the mouse, said the label, one that text equal most up. And we use invalidate method toe Redrow. The graphics inside our most move function. We said the point be equal New point e not X and E that why this is the first point to connect the starting point. Yeah, that's talking. Then if financier down equal true meaning is active. When we press the mouse, we want that the context that drove line and set the pen as paintbrush. The first point to connect bullion off least off points. The stuff points not count minor stool and the second point to connect point least off points off list off points that count minus one. Then, said the label, one not text equal. Most move and invalidate after creating the most events functions. The last thing to do we want toe create a protected over right void on pain. Control involves its own pain metal whenever it needs to change its visual display. And, well, it's also we want to set the default position off the drone image E that graphics that drove image and said the image and 00 the car, the nights. Then we go to the form the properties of the form and search for context, menu story and activate the Context Ministry on the form. After most move function, we go to the properties off the form events and search for mouse down double click if e that bottom equal. Most buttons that left then said the pencil down to true meaning that is active. When we press the mouse, then create a point B equal new point, I said the coordinates either X and either why, ah, to the list off points The point, said the label, one that text equal most down and also invalidate. Then we go to the form. We pressed F five on the keyboard or start the debugging. We see the form we change the color so blue we have most move most, uh, Mose down and we want to change the thickness. And also to save the image the image was safe. Then we go to the containing for their being the bug and see the picture. 8. Third application with mouse events (Part 1): Hello. Welcome to another application in C. Sharp. In this lecture, we will work with mouse events from the toolbox. We need a total street, many bar we added to the form. And inside the third Street, we need six buttons. The photos bottom. We go toe the properties panel display style and change to text in the name First Open, and we create five more buttons. The second is called Save Us. Then Bold, italic underline and Leslie change color. We need the textbooks from the toolbox. Inside the textbooks, we see the focus off our mouths events. Then we need a reach Textbooks inside our reach textbooks. We see the text and can modify it as we want from the bottles that we created. We also must have free functions for every button that we created except for change. Scholar a mouse. Enter a mouse. Leave in the click function. First, we need to take the most events. Most enter and mouse live for the buttons open. We go to the event stub and search for mouse. Enter in double click, then for the open mouse leave, then save us mouse and there, and mostly for bold mouse and there, and most leave for italic most and most leave and underline mouse enter and most leave. Then we wonder events created toe output. The text in the textbooks, when most enter, occurs on the buttons. That means whenever we are hovered the mouse on the bottles, we output the specified text in the textbooks Contra. So for the first button open on most enter, we write the code. Thanks most one not fixed equals press to open a file for the second safe on mouse. Enter thanks, books one that text equals press. So save a file, then for the bold mouse. Enter Thanks books. One that text equals press too bold selection or text. We copy this line and we based for Italic Mouse and there and change the bull to italic and for the underline on most end there, we change the bowl to underline. Then, when we leave the buttons with the mouse, we empty the textbooks control by giving an empty string toe output. So for every bottom, we simply right takes books. One that text equal empty string for open event on most leave for a save on most leave for bold, it'll leak and underline. After that we go to the form we praise. Double click on the savers bottom on simply. We goto the events and double click Here. Inside are safe US click function. We instance she ate a save file. Dialog we call New Safe filed the dialogue. The safe filed yellow component allows users to browse the file system and select files to be saved. Then we set the filter for the instance. Field era equal reach Thanks. Files star not earthy F meaning. When you click the button a safe find their log component is insane. She ated with the filter that allows the safe as type. Then if we take the instance as f the that show the dialogue method equal, the are log result not. Okay, then reach Thanks Books one that say file as f d. That file name the safe I'll method gives you a stream object where you can write to a fire else If we press cancel on the dialog box. Thanks. Books one not text equals The content has not being saved. Then we go to the form press open button. We go to the events and double click on the click event Inside are open click event. First we create an instance off open file the ah log O f the equal new open file The dialogue method the open filed the A log allows users to browse folders and select files. Then we want to filter the fires that we are opening. Or if the that filter equal reach takes files. Asterix that air T f filters make it easier for the user toe. Open a valid file. The open fire. Diello supports filters for matching filings. The Asterix indicates a wild card with UN extension. You can filter by a file type after that. If Oh, if the that show dialogue method, equal dialogue result that Okay, then reach. Thanks. Boats that load file Oh, if the dot file name lows the file by its file name else If we press cancel on the dialog box takes books one that text equals No file has bean open. After that we go to the form press the bold Barton, Go to the event stop and double click on the click event the same for italic double click and the same for underline inside the click bold event. We want, though, make it both or not. So if reach textbooks one. That selection phoned that bold different then true is not set as bold. Then we want to sit as bowl reached a spokes. One. That selection phoned equal. New phoned, and the first is prototype Reach textbooks. One. That selection phoned, and the second is new style rich textbooks. One. That selection phoned about style or phone style. That boat Els restate spokes. One that selection phoned equals new phones. Reese textbooks. One. That selection phoned and restate smokes. One. That's erection. Phone that style. So phone style that bold. We want to do the same for italic event, an underline event. So we copy the code. We based it on the italic and underline and change the bowl toe italic, italic and, for underlying phone style underline. And here underlying. Then we go to the forum. We pressed the change color button. Go to the event stub in double click on the click event Inside the Change Color Click event . First, we want Oh creator instance off color the ah log. See the equal new color Vital'O. Then if see the that show, the are log metal equal the ah log result that Okay, then reach textbooks. One that selection collar equals C The that color else. If we press cancel on the dialog box Pills Thanks Books one dot text equals no color has bean selected. Then we go to the debug Start the bugging and then we see open save us bold italic and underline Every button has a text When we hover over the control When we have our mouse enter then we leave the control and we have an empty string on the thanks Books Let's write some lines. Congratulations. Bold You succeed metallic toe Understand Italic underline every thing. So we change the Carter we breast cancer No color has been selected. We change the color toe blue We right without underline. Then we want to save the file. We also press cancel The content has not been saved. We saved the file as a rich text file onto the desktop events save we delete all we opened the file repress cancer. No file has been opened. Open the file events open Then we have the 9. Third application with mouse events (Part 2): hello in this lecture. Most events Part two we need want three bottles with click event. Most enter event mouse will event in the mouse over, even for a label. First we go to the toolbox. We search for bottom. We added to the form we copy based Bottom two in another button bottom free. And also we want from the toolbox a label label. One. Then we want to set the event for the bottom one. We go to the event Staab, and we want to set the click event. We double click then for the button to We searched for Mo's and though, and double click and for the label we searched for Mo's Over and double click. We begin with button one click first, we said, but on one that hide equal 100. Then we create the variable bull cool equal drew. Then a variable name object mine object equal one. Then a message box that show cool that the string then message bugs that show my object that the string. Then we said the textbooks one that text equaled toe change these properties inside the button to most and terror First we take the first button, not hide and establish the normal height. 20 free. Then we said the first variable bull cool, equal folds and object my object equal to Then he said, the message box and also thanks books one that text equal. Establish the normal dimension. Then, inside the label one most over we begin label one that for color equal Caller that read. We change the color when we hover the mouse the label one. Then label one that cursor equal cars are that had and also said that Facebooks one not text equal label. One. Have call or read and coarser and we also want that label. One. When mouse is living tohave the default color, we go to the form press on label one Goto mouse leave and double click inside the most leave label one that four color equal color that black and thanks spokesman. Not text equal Empty string. After that, we want to create the mouse will even but is not available in the properties window, so we need toe access it in the code. First we implement the method bottom free moms will void bottom free Mose well and object sender and most even our dogs e. Then we ride the code, and after that we explain it. First button free that hide plus equal E that delta slash 60 then button free that with plus equal e dot delta slash 60 button free that nope minus equal e dot delta slash 120 and button free dot left minus equal. Eat that delta slash 120 and said the textbooks one that text equal empty string We used the Delta property off the mouse event are eggs class. The delta represents the number off nah, cheese that were moved forward and backward. Each notch is equal to the will data constant, which is 120. We divide Delta by 60 so each notch off the mouse will moved will only increase the weed and hide by two pixels instead. Off 120. Moving the will forward yards, a positive del tom value and moving it backward yields a negative value. The two lines, top and left, are used toe. Adjust the position off the bottom so it will always be center. Then we go in the forms constructor right below the initialized component method and type the following code Bottom free, Not most well plus equal new mouse event handler and the method that we created Button free mouse. Will we use the event handler for the mouse? Will. Even then we go to the form and press start or the bugging started the bugging and first the bottom one weekly on the bottom one. It changed his hide and show first message through 2nd 1 and change his properties. Display the text on the textbooks one. Then we enter on the button, too, and change the button. One. The normal hide and show falls and to and then established the normal dimension. Then we go to the label one and over the label one and have color red and coarser Han. Then, while the button has the focus and click the bottom free, move the wheel forward to increase the size off the bottom and backward to decrease its size. 10. Simple application with keyboard controls: Hello. In this lecture we will talk about free keyboard events. Kid, Um, keep praise and keep up for the design view. We need textbooks, Controls research for things boast well to the form one in the 2nd 1 first is ah, normal textbooks in the second is a multi line thanks. Books. Then we go on the source code area by pressing F seven inside public class. We need to declare a variable private bull, not number. We initialize it with false, which is Ah Bullen flag used to determine when a character other than a number is ender. Then we go to the form we click the textbooks one and we want to go to the event Staab and create free keepers events. First, we want kid down the work league. This function determines the type of character enter into the control. Secondly, we want key press and lastly key up inside the key down. Even first we initialize the none number the follows then if he that key code less than keys that the zero or e that key code greater than keys not be nine then if e that key code less than keys that Nam pad zero or e that key code greater than keys that non bad nine. With this to eaves, we determine the keystroke is a number from the keyboard. Then we want to determine whether the keystroke is a backspace. If in that key code different than keys that back then we output the text most to that text equal plus equal e the key code, not the string, then set the not number equal. True inside the key press. Even we said the key down event, if not number equal true, then either that handle equal true meaning that stopped the character from being entered into the control. Since it is no numerical then, on key up event, we say if that key code equals keys that f one four e that key code equal keys that after then we give ah informative message box that show you press a f g informative message, then message box buttons that okay and message box icon, not information. After that, we go toe the start. We enter under the buggy mode. We press letters and we show that in displays on the textbooks to numbers just on textbooks one. Haven't we have the key up way? Have press F g F one or F do 11. Make a piano application using keyboard or mouse events (Part 1): Hello. In this lecture we will make a piano keyboard with musical notes on the design view we need from the toolbox 21 white bottles and 15 black bottles. We searched for the bottom. First we expand the form The first button we need the size Toby 47 with and 149 of height. Also, we want the back collar Toby set as bottom highlight. Then we copy repast. We have another button. This one we want to make first back color active caption Black, the four color. But the highlight. And also we want toe set the size 25 with and 90 free off height. Then we want toe Place the bottles in order We copy the bottles, we paste. Then we copy the bottom he based Then copy the two butters Based them one more time and another one. Then we want toe name every bottom first butter. We go to the text door. This is though Shar, then Ray Ray Shar me Fuck far Shar so so sharp. La la sharp and see Then we want toe Copy all the bottles twice. First time and the second time Extend the form and then we want toe rename all the buttons , though we go to the text, though. Do though, too Shar ready to read, too. Shar me too far, too far, too sharp. So do sold to Sharp. Not to not too sharp. See to and then, though free though free Shar Rare free read Free Sharp may free far free for free, Sharp so free, so free shower, Love free love free, sharp and see free. We also need from little books a start of strict control with double click. This sort of strip handers the pressing bottles and tell us what key button has been pressed. We go to the properties and search photo for color and change the control text toe Marone. Then we go to the toolbox and search for context Menu Street Context Ministry and add a bottom back cooler off the form. After that, we press on the form and we must create two keyboard events. We go to the event stub and double click on key press, then on key down. Then we go to the form. We select all the bottles. We go to the event Staab Click event and we give her name on buttons and we press enter. Then we must create to name spaces Forest using ceased them that trading that use more than one threat off execution and using system that run time, not interrupt services indicates that the artery boot method is exposed by on unmanaged dynamic link library as a static entry point. Then, in order to use a function name beep to produce the sound of the musical load we need to import. A dynamic link library, which is recognizable from the system, is dynamically calling on unmanaged de l l from the done it we simply right inside our square brackets. Deal L Import and Garnell 42 not deal L. Then we create a big function public stop Big externally bull beep with two parameters and frequency and in duration. The big function generates simple tones on the speaker. The function is synchro knows, meaning it has equal signals. It does not return control to its color until the sound finish. It returns frequency and duration in a merely seconds. Then we enumerate the notes for the 46 buttons, creative after a public form, one public and Newman Nodes and referred them with the value off the frequency we need to specify. The values are in hurts with decimal points omitted numbers are rounded up for clarity from low sound notes. Toe high Sound notes, though, though. Sharp Ray Ray Sharp Me far, Far Sharp So Seoul Shar le la sure see dough, too Dough too sharp ray to right to shar Me too far to far too sharp. So do so. Deuchar la Do La to sharp see to doe free though free. Shar Ray Free. Rare, free Sharp Me free, far free, far free, sharp. So free, so free, sharp, LA free Ah, free, sharp and see free. After that, inside the Kippers function, we store all the key notes that we press on the keyboard and the sign of value to it. First we create this which he that HR then case one. We call the function beep. We said the frequency as in tiger type and notes that though and also said the duration toe 200 milliseconds. Then we said the these doubts started strip one that items off zero that text equal, though then we break the line. Then we copied the first line eight times. One do free for 5678 Then all three times 12 free. Then we assign a value from the keyboard for every case one do free. 4567890 Miners equal Que w e Ah, the why you I oh be curly braces then a s the if g age g Okay, hell see? V be Then we said for every case, the musical load and the text displayed When we press on the keys from the keyboard we start with the door we have door then those sharp though shar All right, Ray them Roesch are right. Shar me Me then Fob Um far sharp, far sharp. So solve Shar then law, not sharp then see Then go to though too though Tushar No, the sharp ray too right through right The sharp right The shop. Me too. Then far do photo shar then so to so, so sharp then Law, do not toe Shar Then see to then though free, no free though free sharp No free sharp right Free right free right free sharp that we shot up me free follow free for free Shar then soul free Sold three sharp So a free shot law Free love free sharp and see three, then inside gnocchi down function. If we press the ESC key, then it will close the application. If e that key code equals keys that escape, then application that exit. We also want to go to the forum inside the Form One Properties Search for key preview and instead of foes said True, we finish with the keyboard. Events will continue on part two. 12. Make a piano application using keyboard or mouse events (Part 2): Hello. In the first lecture, we said the keyboard events in this lecture piano keyboard events part. Ooh, we focus on mouse events. If we want to click with the mouse a button from the keyboard and play the sound us well, also, we will create a function that will play automatically a song, but we must set the frequencies and durations off the notes. Then we go to the service code and the inside the own buttons function. We must take the text off the buttons displayed on the form and called the beep function and said the start to strip string as well, the same as the key press events. First we said the name, string name Equal Button, send their that text. Then we switch the name in order to us which the name First we go to the key press function and copy all the code based it right here. The next step is to replace the content off the case with string notes that we find on the bottles from the form. First. These? No. Then though sharp Okay, what a shot up. May far far shot. So sold Sharp law. La Sharp seeing me though. Door, though too sharp All right, too right to shower me do far do far too sharp. So do Seoul. Too sharp la du la to sharp see to, though free, though free, sharp but a free but a free sharp, me free, fun free, far free, sharp, so free soul free sharp, La Free La three. Sharp and See free. After that, we create a function that make a melody private. Avoid Melo, the happy birthday object. Send their and even our eggs e First we declared the variables by sitting the duration of the notes int half note equal 1000 milliseconds. One second int quarter Note. Equal half note slash two and eight Note equals half note slash for in dot it quarter. Note equal. Have note. Slash to plus have node slash for and in don't it have note equals half note plus half note slash two. Then we declared on array off object type object and square brackets name, frequency object that takes the notes in a special way that we want to compose a song. In this example, we compose the happy birthday to you song. Inside the array, we simply type the notes, notes that so do notes that so so notes that law to note that So do then notes that though free notes that see do then we copy on based then nodes that ray free notes Not, though, for me notes, not a soul to notes. Not so to notes that so free notes that me three notes that, though for you notes that see through notes, not law do notes that far free notes that far free notes that me three notes that, though free notes not but a free notes that though free then we declare on array off integer type in square brackets, name durations that takes the local variables for every note in frequency. Object. To assign the duration off the note, we have 25 notes and also 25 durations off the notes. Created equal, open curly braces. Close card embraces dotted. Quarter note. Quarter note. Quarter note. Quarter note. Quarter note. Copy this 4/4 notes, then half note dot It quite the note. Then again, 4/4 notes. Half note dotted quarter Note. Another 4/4 notes dotted Quarter note. Quarter note. Court the note. Eight Note, Then quarter note. Quarter note, quarter note and half note. Then we call the function beep toe, Execute the melody beep convert toe into type the frequency object off I and the ratios. Both. I then create another function void, happy and call the function mentally happy birthday Medal of the Happy Birthday with Pointer these as object sender and new even drugs. Then we create a metal there holds the call off the melody Happy birthday function we call Void Happy and the side we call the melody Happy Birthday with Pointer these as objects sender and new even drugs. After creating the happy method, we go to the key press event function, and at the end we press, enter and create another case with those slash and create a new tread trade. Tread happy, but they equal new tread and called the happy method. Then tread Happy birthday dot start and start the thread. Then we said the break at the end of the line. After that, we go to the form Form one Properties and search for context Menu Streep and Change the Context Menu Strip one. Activate the Context Ministry. Then we go impress the Context Ministry and double click on back color. We enter on the service code and here we want to create a new instance off color the dialogue, the LG equal color the dialogue Then if the LG that show dialogue method vehicle dialogue result that okay, then these that back cooler equals the LG that color. Then we go to the form breast start or goto the debug and start debugging. And we want to try first with the mouse, but, uh, then with a keyboard, we also want to change the back collar. And also we want toe play the music melody Happy birthday. Uh 13. Exceptions Handling (Part 1): hello in this lecture will talking about the concepts that we are using inside the handle. Exceptions applications we begin with in C sharp Windows forms exist two types off menus. Main menus represented by menu strip in context does represented by context menu strip context. Menus are activated after program execution by the right mouse. Click context Menus can be Attash toe one or more contras in general. A context menu is attached to multiple controls for each toe. Benefit from many options offered. Attaching the control menu is Desire Shortcut menu by placing the property name context Menu Streep control at the Desire Attachment menu In terms off library classes. Errors are divided on the highest level in two categories. Exceptions toe the application application exception generated by user applications and system exceptions Exception system generated by the common language. Runtime. Veritable machine boat artery from the generic exception plus exception represents editors that occur during application. Execution exceptions require different treatments, depending on their type exception, in which case certain data input is not manage or not possible. Example. Division by zero reading out. Honore. Allowing the exceptional circumstances that lead toe immediate termination off the program The exceptions are implemented by try, catch and finally blocks. Try block generating processing sequence. Contains exceptions between the block. Try and block catch associate ID. There are no other instructions. A block try must be associate ID with at least one bloke catch or even a bloke. Finally, catch block type exception, men urges on exception type. Or it can manage all types off. Exceptions type. Exception represents an instance of a class. The read from exception. Example. Arithmetic exception. Divide by zero exception. Etcetera. Finally, block contains the sequins off processing, which is executed regardless off whether the block try exceptions generated or not and whether they were or not treated. Block Sketch bloke finally is unique, always executing it. Regardless of the blocks, try or catch were executed. It aims to bring a current and go assistant application. State instruction Drove is used to trigger a specific exception explicitly defined by the programmer, Not sweet table cold tro inside the building block. Finally, because at that time, still an exception already exists. Waiting to be treated Instruction TRO generate any type off exception. Try cash. Finally, blocks can be integrated into other blocks. Trying the programmer can define his own exceptions by classes there read from exception 14. Exception Handling # (Part 2): Hello. Welcome to the first application handling the exceptions using, try, catch finally blocks. First, we add to the form from the old books for labels Research for label. We copy the first label based. We have four labels. Then we need free textbooks controls one to and free in the combo box. Come with books we're just and also we need a button. Then we want toe set the names First label. We go to the properties text instead of label one name. The second is gold, the furred gender, and the fourth is Note. Also the textbooks we want to change the name first is TB for textbooks. Name the second. Do you be code the third CB from a combo box gender in the fourth TV note and the bottom. We go to the text first and others. We also want to add from the toolbox a context menu. Streep. We click on the context Minutes trip and odd two bottles inside. First back, color of the form and exit. Then we want to search for our and are provider and also a color br log. Then we pressed on the combo box gender. Go to the properties, items collection and on Thoreau's mail and female the press. OK, after that we want toe create a student class in orderto filter the inputs with text. In order to do that, we go to the solution Explorer on Exception 101 we press right click of the mouse Odd new item, then visual seizure class. And we give a name student that c sharp and we add the class inside the student class. First we create four variables public string, name, public in gold, public string, gender and public in a note. Then we create a default constructor public student We think the name of the class and here we want though set the default variables first these dot name equal No, these that code equal zero these that gender equal? No. And these that known equal zero Then we want to create the constructor with four parameters Public student, first string and for name in see for code string G for gender and beans nt for notes. Then set the names These that name equal end these that code equal c these that gender equal g and these note equal anti Then we said the properties for each off the variables declare. We begin with code public in get code return these that gold and public void said Code in value and this dot code equal value. Then we said the properties for public string name get return These that name and said these that name equal value exactly the same thing we do for gender, gender. And here these that gender and these that gender ICO value. And also for the note note is that note this that note equal value and set the property toe end. Then we go to the forum. We press the button one double click and we enter on the source code Inside the button. One click function We need to check. If every textbooks control on the form is empty, then we activate on error provider, giving a error message to fill the empty space with string text or integer values. Then, if thanks books name not text equal empty string. Then enter provider one that said error Thanks. Boasts name and the door enter. You're name bills. If thanks Books code that text equal empty String your provider one that said error. Thanks. Books gold and the string off error and the the code else. If Coma box gender not text equal and the string. Then enter Provider one that said Error combo Box, Gender and the string Select the Gender Els. If textbooks note that text equal, empty string ed or provider one that set error. Thanks Books Node and the string and the the Note. Hells if textbooks code the text that sub string with the barometers Start index off zero and the number of characters in the sub string the length one equal stirring one and combo box Gender that text equal male then and or provider one set error. Thanks Books code and the string ed or the code is not corresponding with the gender and enter Provider one that set error combo box, gender and the string. The gender is not corresponding with the code, the same we'll do for to substance and female those. We will begin with a try block. Try the try block. It contains the sequence off operations that generate exceptions. We create an instance off the default constructor student s equal new student. Then we convert the textbooks inputs from the properties set inside the student class. It's not name equal thanks. Boats name that text is not. I said goed convert in 32 off textbooks code, not text, then as that gender equal comma box gender that text is not. Note. Equal convert in 32 off textbooks. Note. Not fixed in orderto print A message we can print with the message box, but we want to display, creating a special exception. We create ah, public glass. Special exception we inherit from application. The exception. Inside, we create a public special exception method, then a public special exception. String message. Wheat, a Bays message. Then inside the try block, we bring a message throwing the exception, calling the name off our exception dro new special exception and the string student created with success. Then, in the catch statement, we treat all the exceptions that we need format exception and special exception and other exception as well. On the input, the data first catch four month exception message box that show and are catch the four month exception and exception. That message then catch special exception message bugs that show exception that message. Then, in the final e block, we clear all the error providers this play finally and are provider that clear? Then we go to the form we pressed on the textbooks. Note. We go to the event stub in search for validating in the world clique Inside the textbooks. Note. Very dating. We begin with the try block and create a note. First, Equal convert in 42. The text from the textbooks. Note. Then, if note first less than one or no test greater than then we show a message message. Bucks that show. Introduce the note between one and then and on message box buttons that okay, cancel and message box Aiken that learning. Then we said a catch for all exceptions with the message box that show at our entering the data fields and on message bucks buttons Not okay can sell and message box icon that error . Then we go to the form. We press the Context Ministry and double click on back color and also the exit button inside the back collar button Click. First we create a color. The a log instance color ideologue, D l. G equal New colony Along then, if the LG that showed the I log method because the olive result that okay, then context menus 31 that serves control, not back cooler pickle. The LG that color. Then, inside the exit button click, we simply say application that exit. 15. Exception Handling # (Part 3): Hello. In this lecture we will around the application. But first we must activate the context Ministry for the Contras. We said Either control textbooks. We go to the properties and Suresh Photo Context Ministry and activate the Context Ministry . Do this for every control that you want toe Activate the context Ministry and you can activate even for the bottom. Then we go to the debug tub. Started the bugging. We see the form and press the button we see on exclamation warning. Enter your name we feel with our name John. Then press the bottom, enter the code, want to free, then select the gender male, then enter the note. Five. We see more errors. The code is not corresponding with the gender and the gender is not corresponding with the code because we have one and we specify that one is for female. The beginning with one and two for mayor with us for errors and everything is good student created with success. We have a few more errors. If is empty, string inside the note textbooks. We receive an error error entering the data feels then if if it is 55 introduced the note between one and 10 or if we put letters on the code in posting was not in a correct form air or catch the former exception in and if everything is good student created with success . 16. Exception Handling # (Part 4): Hello. Welcome to the second application with exceptions handling using, try, catch Finally blocks. First we are to the form for labels. We search for Labour's. We expend the form first label control C control V for labels and then thanks books for textbooks. Associate with the labels for things books and then a button. But in one, then another textbooks. A big, big textbooks, multi line. We're way display the message. Then we need toe radio buttons, a cheque, books and on air or provided. Then we need from the toolbox a menu street. We had a menu, Streep, and we need five buttons for his bottom. Ah, percentage off the interest rate. Then we need the grade depth. Then we need toe. Show a message to the big, big thanks boats, then about the up and exit. Then we need to add from the toolbox a vertical scroll bar. Then we give names toe all off the controls from the form we begin with the labels put up with these text and change to some. The second changed the amount. Next their yard and the last one right. That takes both. We change the name TB from textbooks some D B A. Moaned TB, their yard and thebe rate. Then we go to the bottom and change the text. Calculate interest, right? We expand the bottom, then the radio button. One 50% tax. Second radio button, 70% bags and the take boats. Interest rate off. Zero that 11. Then we go to the Solution Explorer and click on the project. Exceptions, handling toe the right click of the mouse and add new item visual. C Sharp class A credit class credit. Seasia Inside the credit class. First, we declared the variables private in some private in period, private float interest and private float. Right then, we said, the properties for each variable declare We begin with public in some get return some and said some equal value. We do these for every variable. Then there you'd than interest. And Leslie, right? We also want toe change the type float and here Asbury float. Then we want toe display a message to the big textbooks from the form we use on override string to string method and we return accordingly, including all the variables that we said we write the code Public override string those three ng in return a string first, the Loan Ammon thing do. Plus these that some plus string. Very good. Oh, plus these, That period plus years and interest. Plus these that interest. Plus it has raids. Oh, plus these that right plus new line. We can coordinate each method which set the variables that will take the input from the textbooks. When we run the program every class in C sharp implicitly it hurts the object class. Therefore every object in C sharp gets the to string method which returns a string representation off that object. Then we go to the form press of seven key and we enter on the source code area. We are one more name space using system that collections in orderto a released inside our public class. We are array least a least. It called new a released. We create an instance off a released and we want to declare two variables double grade that equal one said the value to one the fall and double interest rate as a default value off. Zero that 15. Then we go to the form. We double click on the button inside of the bottle function. We need to check. If the textbooks is empty, then we activate on error provider giving error message to fill the empty space with text or values. First, we declare a variable double max credit without a default value. Then, if thanks, books some not text. Equal empty string, then enter provider one that set error. Thanks boats some and the and our string and the the loan a moment else if textbooks. Among that text equal empty string ed or provider one set error. Thanks. Boasts a mound on the string and the The Net income else. If thanks, books. Very good. That text. Equal empty String error provider one set error. Thanks books. Very other. Select the period in years. Else we will begin with a time lock the tribe look. It contains the sequence off operations that generate exceptions. Inside the try block, we calculate the effective credit rate. We said the Max Credit Equal convert to double takes boats. Amount that text. Multiply off great depth, multiply convert toe end 32 off things boats, period that text. Multiply off well, multiply off one plus interest rate. Then, if Max credit less than convert toe in 42 thanks both. Some that text. We convert the input from the textbook some. So in 32. Then we display a message box that show the amount pretty quiet is to hi and said the max Credit that the string Els Thanks books rate that text equal convert to strain converge toe in 32 The textbooks, some not text slash Convert Not in 32 off textbooks. Period, not text slash 12. Multiply off one plus interest rate. And then we said the metals with properties from the credit class and convert them as valid inputs. We create first an instance off credit, Sea air, new credit. Then we day the instance and first interest equal. We convert afloat float interest rate. Next is some equal convert toe in 32 Thanks books some that text, then 30 years equal convert. So in 32 thanks books, period, not text and rate it. Go convert afloat. Convert to double Thanks. Books rate that text and we use the least a least ad. The instance. Then on the catch block. We handle all exceptions that appear and resolve them with a message printed to the screen message bugs that show and on input that Tom and on and message box buttons. Not okay. And message box icon. Not at all. On the finally block, we clear all the error providers it or provider one. That clear method after we finish with pressing on the bottom said the valid inputs on the textbooks controls and result of the errors we continue on next lecture. 17. Exception Handling # (Part 5): Hello. In this lecture, we continue the application. First we go to the form. We go to the Menu Streep file and we want toe double. Click the first button percentage interest rate, then double click on great depth show message above the up and exit. First, we begin with the interest rate. At the beginning, we said the interest rate variable toe zero that 15 meaning that is unemployed. E If it is on employees, then the bank lowers the interest rate. If Jake Books one that checked equal true, then interest rate equal zero that 11 and set a message box that show the interest rate was said at plus interest rate that to string and informative message message box buttons that okay and message Bucks Aiken That information. Then, in the great depth function, we make some radio button validations. If Radio button one that checked Equal Falls and radio button to that checked equal force, we print a message message box that show please select the marital starters. Els. If radio bottom one that checked equal true. Then we said the grade debt equal zero, not five, meaning if it is married, it can have the depth to 50% else. If radio button to that checked equal. True, great. That equal 0.7, meaning that if is not married, it can have the debt to 70%. And we print a message message box that show gearing was set dual plus grade that that to string informative message message box buttons that okay, message box Aiken That information. Then in the show message function, we create the for each credit sea air in a least, then textbooks five that text plus equal Sierre that to string plus environment. That new line, the for each statement is usedto iterated through the collection together information that you want and display the inputs inside the textbooks. Then inside, above the up we bring the message box that show credit calculator version 1.0 about the, uh, message box buttons that okay and message box icon that information. And inside the exit, these nuts close and we terminate the program. Then we go to the form press on the vertical scroll bar, go to the events and double click on the scroll event. Inside the vertical scroll bar. We take the text from the textbooks, their yield Bqool Vertical Scroll Bar one, and we assign the value and convert toe string. After that, we go to the start and we enter under the buggy mode. First, we want to check the errors. We cleaned the bottom. We see the error enter the loan amount so far was on. Then enter the net income 200. Select the period in ears 12 and the rate is 14 95. We also want to check the interest rate. Zero that 15 beef old. If we take the textbooks off, zero that 11 and plagued the bottom and then go. So the interest rate is zero that 11 then above the up credit calculator version 1.0 interest rate 0.11 and great depth. Please direct the marital status. We select 50% rate. That gearing was set to zero that five or during was set to 0.7. Then, if we want toe, increase the period in years, we go to the vertical scroll bar and adjust and then it adjust the rate. Then, if the sum is so big, we click the button and we pop up a message with the error. The amount required is too high, or if we want to show the message, it will display all the messages when we press the button. 18. Calculate Interest Rate: Hello. Welcome to the first application handling the exceptions In this lecture we will calculate the interest rate of a credit amount. First we had to the form from the toolbox. Five labels. We copy the first label we based. Then we need to textbooks controls first in the second. The second must be in the properties. Read on Lee. We set the read only too true. We also need from the toolbox a comma box, a cheque, books and also a button and on air or provider. Then we name all the controls we begin with label one. We go to the properties text and change the label One though some credit. Then the things books. We go to the name and changed the textbooks credit. Then the label five is for currency chosen. We changed though you were all able to credit schema label free special clients label for you Really fixed rate coma box. We changed the combo box schema and the Italy fixed rate They expose rate the bottom compute. After that, we go to the solution explorer, Then to the project we click the right click of the mouse Goto odd new item and we want to create a new class credit schema c sharp. Then inside the credit schema class. First we declared the very balls public string name, public in barriers and public float rate. Then we want to create the constructor with Para Matters Bob Leak Credit schema String name in Better You and Float rate and set the names Name equal name Better You equal where you and rate equal rate. Then we want to go greater override to string that we want to display income a box Bob Leak over Ryan String to string and return name plus string plus rate plus percent age off plus very good plus years. Then we need toe Calculate a formula for refunding public double refund double Khost float I from investment Equal rate divide by 1200 then in why for a year equal Very good Return cost Multiply with investment divided by one miners met that bow one plus investment and the power minus Why then we go to the form we press f seven key and we enter on the source code area Then we begin with creating a new method Calculate the interest rate private void Compute if takes books, credit that text equal empty stream, then return. We create a variable double credit. Equal double that bars. Thanks books. Credit that text. Then we want to create an instance off credit schema Schema that holds the selected item from the comma box. Equal Credit Schema com A box schema Not selected item Then if Jake Books one Not checked schema that raid equal schema That raid minus five then we set the four month inside the textbooks raid, not text. Equal String that format first is the format zero, not 00 and the object to format schema that refund off credit. Then we want toe set the rows inside the combo box Private void Initialize cover box scheme combo box scheme that items that ad new credit schema Oh, the name bones The period seeks the rate. Eight. Next combo box schema dot items That ad new credit schema Oh, the string silver The period 12 The rate, Then then combo box schema dot items that on new credit schema. Oh, the name Gold Period 18 and rate 12 Next com A box schema that items that ad new credit schema off Platinum 24 and 13. And also we want Toe Select the index combo box schema. That selected index equal one first is 012 and free. Then we want to go to the public Form one and after initialized component, we want toe put the initialize combo box scheme method. When we run the program, it will load automatically. Then we go to the form we double click on the Compute bottom one inside the button. One click if takes books, credit that text equal empty string, then enter provider one. That said a rod Thanks Books, credit and the error string and the the credit. Then dry. We said the method compute and the catch block for a month exception. Eggs, message bugs that show and on catch format exception and eggs, not message. Then we press F five unlucky bird or start to enter under the buggy mode. First we click the bottom Compute. We have a warning entered the credit 100. We set the credit. Breaux's compute. Then we take the cheque books minus five, then silver, gold and platinum 19. Files and XML Files: Hello. In this lecture, we're talking about the concepts that we are using inside the text and XML files applications. We begin with working week text files reading text vials in C Sharp is used file stream class That was the real from stream class toe. Odd necessary functions off reading and writing toe the text files in order to read from a text file, we need to include appropriate library using system that input output. We need to create an instance Off file Stream plus fire stream file Equal New fire Stream the file The mod Open in the access read Final mode filed stream. Specify what to do with the file when you access and has the following options upend, create, create new, open, open or create or truncate find access, specifies the privileges off the file and has options. Read, read, write or just right. Writing text files writing a text file shall be include appropriate library using system that input output creates on instance off file stream five stream file, equal new file stream the file, the mode create and the access right. Then we create an instance Off stream writer there read from takes Writer then we write in a text file. Using the right method, we close the Stream writer and the file stream. Next step serialization Saving data in a binary file is done by serialization. Serialization is a method which allows the transformation often object in a sequence off bites, which can be later restored in the original object Serialization allows an object to be converted into a data stream, which is then stored in a binary file. Serialization involves the operation stages Declare a class as serialize herbal by adding before the definition off the class, the at reboot serialize herbal, then adding appropriate libraries using system that input output and using system that runtime that serialization that for matters, not binary. We in Stan she ate an object off class, far stream with a file the mode create and the access right. We need the binary for matter class, object instance. See ation. Then we call the serialized method for binary for matter class and lastly we close the stream. Next step this serialize er the reverse process off reading a serialized object to restore the original condition is called the serial Isar. The serial Isar operation involves the steps in San. She ate on object off class file stream with the file, the mod Open and the Access raid. Then instead, initiate an object off class binary for matter calling method the serialized binary for matter class and close the stream. Next step XML XML is short for extensible markup language. It is a very widely used format for exchanging that, uh, mainly because it's easy readable for both humans and machines. A simple structure, often XML file A barren node is the root element off the file and the child load and the content inside. Reading XML file reading from an XML file can be made using the method read from abstract glass XML Reader in system that XML name space. They're mainly to methods for reading XML files with C Sharp XML Document class reads the entire XML content in tow Memory. An XML reader class is a faster and less memory consuming alternative. It lets you run through the XML content one element at the time while allowing you to look at the value and then moves on to the next element writing XML File XML Writer You will have to write the entire document from scratch each time. First, you need to great the file with the name right, the start, parent node and child nodes and also close them. 20. Add, View, Delete Student from File (Part 1): hello in this lecture will discuss about files and the operations that we use on files. We store them in a least view. We add default fields from the function we had one by one, we delete by selecting the row, save the fields to a new file and restore the default fields in total eastview. First we need from the toolbox toe other controls to the form. We adjust the form, then research in the toolbox least of you and double click. Then we need free labels enabled one able to and the label free, then free textbooks, controls and five mothers. Then we name all the contra owes and first said the properties toe the least view. We go to the property spanner, and first we change the checkbook sees toe through then alone column reorder the true then grid lines. True, Full Rose. Select through and also view as details. Then we go to the columns correlation and click on the collection. Inside the members area, we add three members in the first column, Heather one Goto text and change the code. The second column name and the third column note Press OK and arrange Then we go to the label one Goto Properties and change the text toe code. Second, label the name further labor to note and also the textbooks controls first things Books go to the name and changed, too. Thanks, folks. DB Gold. The name to be name and the note be note, and finally we change the text for the buttons, but on one, we goto the text and changed, too. Populate then second button and forward button delete. Next bottom save and the last button restore. Then we go to the solution Explorer Press the right click of the mouse on the project. Odd new item, and we give her name. Class stood on inside the student class. First we declared the variables private in code private string name and private float. Note. Then we want to create the constructor public student with free bottle matters in SI for code string and for name and float anti for note. And we assigned the variables code equal C name equal and and note a call empty. Then we want to set the properties public in code. Get return code said Code equal value. Public string name. Get return name and said name equal value and public float Note. Get return note and said note equal value. Then we want to goto the form, press right click of the mouse and view code. Inside the Coach service area, we declare to name space using system that input output and using ceased them that run time that serialization that for matters that binary these two names spaces are used toe working with files. We create another nine space using system, not collections in order to work with a ray list. Then we go to the form impressed, double click on each bottom first on populate, then on odd believed, save every store. Then inside the first button, we need toe populate the least view with fields. In order to do that, we make an instance off the class and set US array with four records. Still them. Array victor off students equal new still don't off for records. The first record collector of students of zero equal new student and first the Code oneto. One second string name LeBron James and the note. Then the second record. One equal new student off 1 to 2 Kobe Brian, then note nine. Then Victor students off to equal new student Oneto free Michael Jordan with note off eight then victor of students off free equal new student 1 to 4 Carmelo and Tony and with a note of seven. Then we use a local variable with a loop toe out the items in soup items inside the least view for each still done s we create the local variable in victor off students then least view item We create an instance off Listsview item equal New listsview item off s that gold that to string then item that soup items that ad as that name then item off Sabah items That ad is that note that to string then lease view one, not items not add the item Then on the second button we must add a record in tow The least view for that We use the try catch finally blocks We begin with dry First we must great An instance of the class stood in s equal new still done and convert the types The inputs from the textbooks controls first convert though Int 32 takes books code that text second textbooks name that text and float convert to double off Thanks Boc's note that text. Then we need toward the records toe the least view for that. We go to the first button, populate and copy the code and based inside the try block. Then we go to the catch block. We said the exception eggs and bring a message message box that show and are input that, uh, and set the message X not message. Inside the finally block, we simply clear the text inside the textbooks controls thanks. Books code that clear takes books. Name that clear and also takes books. Note that clear. Then on the fourth button, the delete button, we create a loop to search in items for that once that the check boxes are checked and remove it from the least view for each least view item I the m in least view one that I thumbs. If i tm that checked equal true, then I tm that remove. Then on the bottom four, we save the items from the least view toe a new file. First we create an instance Off file Stream s equal New far stream that has free arguments . First argument is the file where to write the data student that takes them, then the mod file mode that happened the data to the file and file access that right? We want to write the data to the file. Then we build, Ah, binary for mother binary for matter in create an instance b f equal new binary for matter that we use it to serialize or encode the data to the stream in a special former. Then we need on a released a least instance equal New a released where we add the items. Then we create a look to search in Lee's view items and add the item for each least view item. I see em in Lee's view, one that items, then a least that ad the item. Then we want toe encode or serialize the data within the file, using the binary for matter that serialize and taking the file stream and a leased the array. Then we close the file and this view one that items not clear. We clear the items from the least view, then on the last button, restore button very store or open the last saved file and the serialize, or decode the content normal text and take the content off the file. and put it inside. Off the least view Fire stream F s equal new fire stream and take the safe file. Student, That base there, The file mode. No, he's open in the file. Access read. Then we create the binary for matter b f equal new binary for matter and the are released a at least equal array least. And they be f that the serialize the fire stream. Then we can't all the characters and add them toe the lease view for int I equal zero I less than a least that count I last glass, then lease view one that items that ad least view. I thumb a least off I and close the fire stream. 21. Add, View, Delete Student from File (Part 2): Hello In this lecture will create two events for the least view and run the program. We go to the form we press on the lease view, go to the properties, even stop and search for item Check, item checked and double click and also we want item activate inside the item checked first we say if e that item that checked then e that item that back color equal color dot Ray Then inside the item activate for each at least view item I m in least view one that items then if I d m that selected equal drew then I tm that for color, equal color dot orange red Then we go to the form the bug started the bugging and we see the form First we press on the populate bottom and feel the least view with records that we've created. We see the records Then if we press on the at bottom we see up up up at our little input data because we don't enter text inside the textbooks controls we press. Okay, we want toe. Add a few records. 1st 1 to 5 Greece bull and note seeks ad then automatically it. Ah cleared the takes from the textbooks. Then add more records. One through six Duwayne Wade and note five. Odd. Then we want to see the item Activate. Reactivate the record and automatically It was checked. Checked as back color gray. An item activate for color red. We Jake do more and we see back. Color gray. Then we want to delete one item Carmelo Anthony delete. Then we want to save toe the file, Save it. Clear the least view. Then we want toe restore all the records. Inside the least view press the restore button and we see older records. Then we close the program. We go to the containing folder open containing further being the bug and see the file student that takes there. We open the file and we see that the file is encoded. 22. Add & Modify Rows in a Listview and Save the fields to a file: hello in this lecture will discuss about open and safe a file from the least view aren't modify and delete rose inside the least view in a different way than the previous application. With files we need to resize the form. First we go to the toolbox and search for police view and double click. We need three bottles, second button and first button, and also we need from the toolbox a to strip with two buttons inside. Then we press on the least view. We go to the property spanner and search for checkbook sees and said True. Then Full row Select said. True great lines said True and also view as details. Then inside the columns, the collection click on collection and odd three members. Forest Member. We go to the text and set those code. Then name and price. We press OK, we arrange the Gollum's. Then we go to the bottom one to text and said as odd. The second button modify in the first bottom delete. Then we go to the strip menu. First Barton, we go toe image and import an image import save open. Okay. And the second bottom import open. Okay, then we go to the solution Explorer, we click the right click of the mouse on the project on new item visual C sharp windows form form to on. And we added another form inside the form to first. We need to resize the form, go to the pool books and such. For textbooks. We are free textbooks control and two buttons. Then we want to name the controls First the bottom one go to properties. Text okay. And the second bottom again. So then, on the things books, first things, books we changed. The name toe takes books. Gold The second. Thanks, folks. Thanks. Boats Name and the third Thanks. Boats. Thanks. Books price. Then we want toe. Activate the two bottles. OK, in cancel first. Okay. We pressed the bottom. We go to the properties and search for VR log results and change though. Okay. In the council bottom, the yellow result can. So when we click the bottom one in button toe on the form one, we showed the second form and take the inputs text from the textbooks controls and add them to the least view inside the form one. We also need to change the modifiers off the textbooks. Research on the properties modifiers and change from private. The public in orderto have access in different forms for the second textbooks, modifiers, private, public and also public. Then we go to the form one in double click on odd, then double click on modify, button the lead and then save an open source. Three button before we begin with the first bottom, we need to declare free nine spaces first, using system that input output for files using cease them that run time that serialization , not for matters that binary for serialization and using system that collections for a released. Then inside the first button, the add button. We create an instance for the form toe link. One equal new form toe then, if link one that showed the A log method equal the olive result that okay, then least view item. We create an instance of the least view item and take the inputs. Text from the textbooks controls in the form toe and then send them toe the least view one item equal least new least view item off link. One that takes books code, not text. Then item that soup items not and link one that takes books. Name that text and item not serve items that ad link one that thanks. Boats price that text and then least view one that items not add the item, then inside the bottom to the modify button. First, we create an instance off form toe link to equal new form to then lease view item off. Selected. We want toe. Select the items that we are going to modify from the least view. Equal least view one that selected items off index zero. We select a row from the least view, then link, so that takes boats. Code not next equals selected that soup items off. Zero. We take the first sub item that text, then link toe that textbooks Name that text equal selected that some items off. One The second serve item that text, then link toe that textbooks price, not text equal selected. Not some items off to that text. If link toe that showed the olive method equal the olive result that okay, we want toe. Take the selected items and show the form toe with values on the textbooks controls and change the text inside and send them toe the least view selected that some items off index zero first so by item, not text equal link toe that textbooks code that text selected that serve items off one that next equal linked to that Facebook's name, not text and selected US of items off to the text. Equal link to that textbooks price, not text. Then inside the bottom, free the elite bottom. We create a loop to search in items for that ones that the check boxes are checked and remove it from the least view for each least view item item in Lee's view one that items if item that checked the check box is checked equal drew, then item that remove. Then inside the third street bothered one the safe button. We declare the variables first file stream if s array least a least and binary for matter B f Then we initialize the instance for F s Far stream equal New far stream And first the file that we right though players that they stand and the mode file mode that create. Then we initialized the instance for the Rail east a least equal new array list. Then we look through the elements inside the least view forage least view item I thumb in least view one that items a least that ad the item. Then we initialize the instance for binary for matter equal new Beiring for matter then B f that serialize we encode the fire stream and the array list. Then fire Stream that close, we close the fire stream Then we go to the your story button toe open button We declared the variables far stream F s array least a least and binary for matter b f Then we initialize the instance for five stream. They call new fire stream, take the file players that takes them and said the file mode to open then binary form other We initialize the instance new binary for matter and the code the content a least equal a ray least be F that the serialize the fire stream Then close the fire stream After we opened the file decode it's gone turn. We looked through all the characters and add them to the lease view. For in I equals zero I less than a least that count I plus plus. Then we declare this view item my thumb I thumb equal least view item a least off. I least view one that items that ad the item. Then we go to the debug. Started the bugging. We see the form. First we press the art button, we see the second form, we press cancer and we are back to the first form. Then add again. We want the introduce. A new record one LeBron James 20 male, you know repress. OK, we have one row. We are one more. Colby Brian. 25 1,000,000 and one more Ellen Iverson. One millions. The press. OK, then we select a row, we modify it and we modified with the Wayne Wade. 50 million. Okay? And it was change. Then we want to delete Dwayne Wade. The lead repress the safe bottom. Then we delete both rose and open the file. Then we end with the application. We close. We go to the form press right click of the mouse open containing folder. We go toe being the bug and we have the fine players. Don't take stay. We opened the file and we see that is encoded 23. Application XML Basics (Part 1): Hello. In this lecture, worked with XML Files will discuss about showing a list of students at values inside the single known in the XML file on the end of the file from the function created Load on XML file and display the content inside the least view. And if we select a note from the least view will add the nodes with the values toe. A different XML file first will maximize the form. Then we go inside a little box and search for lease view and add it to the form. Then we search inside the toolbox. A context menu strip. We are free bottles first, create node. The second button show at least off students in the for button display array. We need also a menu stream inside the Menu Street. We need just one button XML node. Then we person the least view. Go to the properties and change the full row. Select true grid lines true and also the view as details. And inside the columns collection, we are free members. First column. We change the text. The name second column age in the last column so I d. We press OK, we are range local looms. We also want toe activate inside the properties the Context menu Stream context menu strip one with the free bottles. Then we need to go to the solution Explorer. Click on the project on new Item glass, and we give her name student. On first, we declare a class as serialize herbal by adding before the definition off the class. The attribute Serialize herbal serialization allows an object Toby converted in tow that a stream which is then store in a binary file. Then we said the student class as public. Then inside the class. First we declare the variables static and number off students, and we give a value a default value off zero, then stirring name in age and in code. Then we create the default constructor public student that take the name of the class for serialization, and we give values name equal, empty string, age, equal zero and code equal plus plus number of students. Then we said the constructor with the power matters public still done studying name and int age name, equal name, an age, equal age and gold, equal plus plus number of students. Then we need to set the properties public string name, get return name and said name equal value Also for public in age get return age and also said age equal value and for public in code get return goed. After that we go inside the form we press on the keyboard F seven or simply view code Then we are a few more libraries using system, not input. How would using cease them that runtime not serialization, that for matters that binary for files and Sarah realization then using suits them, not XML and using ceased them that xml not serialization for XML files an XML serialization and also using cease them that collections for using a released. Then we go inside the form clear the right click of the mouse open containing further being the bug. And here we want to create a new takes document we name as a student that xml Yes, in another one new text document and we name students the XML Yes, and open the file with no bad. And inside we create the dog students, we close students, Then we create a student. We close us toe done and inside we give a name close the name age close the age, and also we want to sit for free students so free. The first is LeBron James. The age for the then Carmelo and Tony in the age is 41 then the Wayne Wade in the age 29. We save it. We also want toe odd I d. Equal 100 then the second Still done I the equal 101 and the first to then I d equal 100 to save and return to the form. Then we go inside the go sores area. Inside the public glass, we declare a new variable public array, least least off students. Then we create a new function that adds students toe the array. Private void initialize array off students. We initialize the list off students array equal New array least then leased off students that ad new student and said the name Ellen Iverson in the age 40 least of students not add new student name Kevin Duran in the age 27 least off students that ad new student Kevin Love in the age 28. Then we copy the function, the name off the function, and inside the main form we call the function to set the array in order to click on the bottom and show the array. Then we need to create one more function. Private void show array off students. We two parameters at least view LV and a ray least a least. Then we clear the items not clear. Then we looked through the students that a rate off students for each stood in stood in a least Lee's view item. I thumb equal new least you item off stood that name item that soup items not add stood that age that to string and item that sub items not add stood that code that to string and also at the item L V that items not add the item. We'll continue on the next lecture. 24. Working with XML Files (Part 2): hello in this lecture will continue creating a node for the student that XML. Then we take the XML file students and display the content inside the least you we show the least off students and we add a note with values in the XML file. Other end off the file from the function created. First we go inside the form we click on the context menu Streep in double click on the create node bottle, then double click on show least students display array and on the file at XML node. First we begin with a create node bottom. Inside the function we looked through the least view items for Reach Lee's view item item in Lee's view one that items Then if we select a row or an item item not selected, we take the student stood equal New student We took parameters The name in the age item that soup items off zero the first element that text in the second Ellemann convert toe end 16 item that soup items off one that text. Then we create a instance for the XML serialize er X s equal New XML serialize er type off Still done. Then we great a stream as equal file that open and right the student, not XML. Then we serialize. We think the stream as and the object stood. And also we close the stream as that close. Then inside the show, least off students First we clear the items inside the least view one that items that clear . Then we create an instance for the XML document dog equal new XML document. Then take the instance Doc and load the student's file students that XML and also we create an instance for the XML knowed laced, laced equal dog that get element by Doug name and the duck name is student. Then for every student inside the least for reach XML node stood in least we take the specified values inside the students that XML file and add them inside the least view string I d equal stood that at three boots off i d that value string age equal stood off age that first child that value and string name equal stood off Name that first gile that value Then create a least view item Instance item equal new lease you item and take the name then item that soup I terms that ad the age an item that soup items that ad off i d and put them inside the lease view. Please view one, not items that ad the item. Then, inside the display of Ray Bottom, we simply call the function show array off students and take the least view one and the least off. Still, Dunn's Then inside the XML bottom from the menu strip, we create a new note at the end of the XML file. Every time the bottom is click, we create another note with the values inside the students that XML file. First we create a XML document Instance dog equal New XML document. Then we load the file students, not XML. Then we need to create a XML element stood equal, Doc that create element And the element is ah, new student. Then we said the attributes i d and the value is 1000. Then we create a new XML node name Equal does not create known. The no type string is element. The name is name in the name space. Yuri is empty string. Then name that inner text Equal the value Steve Jobs and stood that a pen child the name, then we great. Another XML node Age equal, Doc. Not great Node element age An empty string age that inner text equal 50 and stood that a pen child the age. Then we take the document document element a pen child The XML element stood And also Doc that save the XML file students that XML After that, we go inside the form click on the debug, start debugging We see the form we click the right click of the mouse inside Elise View display array and we see their records. Then show least off students inside their students that XML we see the records. Then we want toe klik on the record and create a node. But first we need to see the files stood on that XML is empty And students that xml we have free nodes. We want what? Inside the student that xml LeBron James Great node. We see the file and it has added LeBron James the node inside the student that xml then we need to go to the file on XML node And it has added inside the students that xml the Steve Jobs with I d 1000 and age 50 and we want to check inside the Eastview show least students and Steve jobs up here 25. Load, Read, Save Student in XML File Application: Hello In this lecture will discuss about creating an XML file loading the selected knowns from the XML file in tow. Elise Books read the content in the textbooks control and if we want to modify it inside, then we can save the content in a different XML file. First, we add to the form from the toolbox to labels. First label. We name the text. Two players controversy Control V in the second, the XML then we want to add a least books. Hey thanks Books. We make it multi line. Then we need three buttons The footers button We name Load XML. The second bottom Read XML and save XML. Then we go to the form one press the right click off the mouse open containing folder we go toe being the bug and the inside. We create a new thanks to local men with the name off players that XML we opened the file and the inside the file we want to create first as barren node players ending Thank players , then player and the inside the player Name theme and points. We are two more players and inside the name first LeBron James Theme. Cleveland Carvajal years. Brilliance. 27,000 points. Then we populate the second player Got a middle Anthony theme. New York Necks Points 24,000 in the first player. Kobe Brian, Los Angeles Lakers and points 43,000 points. We save we close, then we go inside our service called area after using system that we knows that forms. We declare a new library using system that XML. Then inside our public class, we declare two variables. First, private XML, Dunkleman dog equal No, we said that's no. Then private XML node least players equal know as well as a default property. These two variables will use inside our class inside our functions. Then we go to the form and double click on each button. Then inside the first bottom load XML button. First we initialize the instance for the XML document, Doc Equal New XML document. Then we want the load The file players that XML then we use the players variable declare outside the function equal duck that select nodes and we survived the nodes players slash player. Then we looked through all elements for in I equals zero I less then players that ground I plus plus and we great An instance of the XML node player. Equal players. That's I thumb off index I every player that select single node with the name. Then we want to display the inner text for the name off the player inside the least books, these boats one that items not add player that inner text inside the least books event. First we declare a variable in I equal these books one that selected index. Then players equal Doc that select nodes players slash player. Then we create a X 1,000,000 node theme. Equal players off item off. In this I that's elect single node and we can choose theme or points. We choose theme. Then we want to display inside the textbooks. The inner text off the team takes books one that text equal team, not inner text. Then inside the second button, read XML bottom. We need to go take the content from the XML file players and put it on the textbooks Contra First we cleared the textbooks one that text equal empty string. Then we create a X Miller text read there eggs are equal. New examine takes reader and the file players that XML then while eggs are that read, then switch eggs are not node DYP then case XML No type that element the type of node. Take spokeswoman that text Equal textbooks one that text glass less than bag plus X are that name plus greater then bag plus new line slash air slash and and break. After taking the beginning node, we must take the value inside the node. Gays XML No type that text takes books one dot text equal textbooks one that text plus empty string plus X are that value plus new line and break Finally will take the ending node case examiner. No, type that en element. Take spokes. One that text equal textbooks on that text, plus less then slash plus X Are that name plus greater than glass? New line. I'm break. Then we want toe close the XML reader that close. Then on the last button bottom free safe button. We saved the text content from the textbooks toe a new XML file with all the modifications made inside. First we create an egg smell. A text writer instance x w equal New XML takes right there and first the final lane players file that XML and doing coding We said as no. Then Golding writes the file as ut f eight. Then we said the XML writer for my thing equal for my thing that invented then we great the string s equal textbooks one that text. Then for int I equals zero I less then not length for every character I plus plus then if s off index I different than new line slash air and as off I different than slash and then x w that right? Studying off s off I that the string else If starting off index I equal new line then the right there That right string new line slash ere slash n Then the writer flush we flushed the buffer recommended for the output streams toe get rid of them and close the writer Thanks w that close We need to go to the forum, then resize the form, resize the textbooks and move the butter's. Then we press start or the bug started the bugging I went there on the form. First we load the file we press on the first selected item LeBron James and we see the team Cleveland Cavaliers Carmelo Anthony, New York Knicks and Kobe Bryan, Los Angeles Lakers. Then we want toe. Read the file and we see all the off the file. We change the points, though. 50 frozen and New York Knicks, though then save the file. Close the form, go to the containing folder being the bug, and we have created a new file, then open, and we have the file with the modification made with less then in greater than. 26. Parse, Generate, View, Save & Open Xml File App (Part 1): hello in this lecture will discuss about parsing the data from the XML file, display the content in tow textbooks control, generate an XML file with proper format, open the file by radio from starting in and display the content inside the textbooks. Control We modified the content and save the file or open another file. First, we must resize the form. Then we aren't from the tool box labels. We need five labels, second label furred, five labels and also five textbooks controls and another one another things both which is multi line. And we need five buttons. And also we need a open fire the along and say filed the dialogue. Then we named the Contra owes as a basketball re Ference. We begin with label one. Go to the Properties, text and change Toe Day. Tom Label, too. Detroit Neighbor Free Brooklyn Nerds, then Boston and the label. Five. Cleveland. Then the Things Boc's Change The name takes Books Day, Tom Detroit. Thanks Books. Detroit takes books. Brooklyn Nets Thanks Books Boston and Takes Books Cleveland And also we want to name the bottles First button bars, XMM. But in two generate XML bottom free view XML but, um, for save XML and bottom five Open XML. Then we go to the open containing further inside bean the bug. We create a new file themes that XML we have The file, the data said, is the root node. Then we have a heather with publisher Nation of Basketball Association a publishing date. Close the heather, begin the body. We have ah subject the date and the theme abbreviation and the theme we close the date, the body and the route data said. Then we press the right click of the mouse view code. We enter on the source code area and we want to add more libraries using system that XML for using the XML files using system that input output forced dreams using system that run time that serialization that for matters that binary for serialization and using a system, not collections for a rail east. Then we go to the form and press double click on each button. First powers then generate view save an open. Then on the first button Paris bottom, we create an instance off the stream Reader s are equal New stream reader and we love the XML file themes that XML. Then we declare a string variable string file equal, as are read to end that reads the entire XML file from start toe end. Then we create an instance of the XML reader reader Equal XML Reader, not create new string. Read there that they file then, while reader not rain while reading the note by known then if reader that name equal publishing they we check if the name off the node is equal with a string element from the XML file and reader that no type equal XML note type, not element. Also, if it is the Keuren element, it reads the next note off the stream and gives the value off the Keuren known then reader that rain and take spokes data, not text equal reader that value if it was read, then gives the value from the file and displayed on the textbooks data. Then if reader that name equal theme the beginning of the known we said a string variable attributes equal reader off abbreviation. Then, if attributes equal Detroit, then reader that read and thanks books Detroit that text equal reader that value. Then we copy the IV and we paste it three times and we change. First Brooklyn nerds and inside the textbooks Brooklyn nerds, then Boston and thanks Books Boston and also Cleveland and said Textbooks, Cleveland. We also want to delete the closing bracket from here and added at the end. Then on the second button the generate XML button, we need an instance off the memory stream, ma'am, stream equal new memory stream that creates a stream stored in memory. We also need a XML text right there with the new business off right there. Equal new XML text brighter with two arguments meme stream and encoding that ut F eight that generate streams or files containing XML data in which you want to write. We also want to sit the writer that formatting equal formatting that indented. Then we using right there we start writer that right start document then right there. That right start Ellemann with the name M B A themes After we create the root node, we want to create the daughter node and then the team's knows right there. That right start element with the name off data. They're right there that right value off textbooks data, not text. And right there, that right en element. Then we begin with the first team right there. That right start element theme right there. That right? Actually boot studying the everybody's observation in the name is Detroit, then writer that right? Value textbooks Detroit that text. And right there, that right, and l a men. Then we copy these node three times and inside next is Ah, Brooklyn Nets. And also thanks. Books Brooklyn Nets, then Boston, Boston and Cleveland. Cleveland. And we want, though end the MBA teams knowed writer that right? And Ellemann and also writer that right and document And we also outside we want to close the writer. Then we declare a string variable xml equal encoding not ut f eight dot Get string off, ma'am. Stream the array We ride the stream contents toe a bite array and then we close the stream off memory Mom stream not close. We create an instance off stream right there is W equal New stream writer in the file stream new file that xml staying writer implements an instance and write the characters toe the stream Then we take the is w that right line the xml We closed the stadium right there and we give Ah, message of success message bugs not show file General rated with success. Then on the first button, the View XML button, we want toe open and read a stream file. In order to do that, we take the file stream. Great. An instance F s equal new file stream. We think the new file that XML the file mode that open and the file access that read. Then we create ah stream reader as our equal new stem reader. Then we take the textbook six that text Equal Stream reader that read to end. Then we close the stream reader and also we closed the far stream. We continue on the next lecture. 27. Parse, Generate, View, Save & Open Xml File App (Part 2): Hello in this Rector will continue with Save an Open the file. But first we forgot toe put inside the stream reader the incidence off far stream then inside the four button the safe XML file first if save file dialog one dot show the dialogue equal the hollow results not Okay Then we create the nous nous off file stream f s equal new fire stream We take the safe file dialog one that file name the file mode that create and file access that right we create then a binary for matter Instance B f equal new binary for matter and array Least a list equal new array list Then for every string inside the textbooks for each steering as in thanks Boat six that lions then a least that ad the string Then we serialize the stream and the object b f that serialize father stream and a least we close the file stream and we cleared the textbooks Then inside the five button the open bottom we dis realize the content and get the characters toe the textbooks control first If open filed their log one that show the alot equal dialogue result that Okay then we create the file stream Instance F s equal new file stream open file dialog one that finally file mode that open and file access. That raid we create the binary for matter Instance B f equal new binary for matter then array loosed a least equal array least b f that the serialize the fire stream Then we get the number off elements for in I equal zero I less than a least that count I plus Plus we get the lines toe the textbooks Thanks Books six That text equal plus equal a least off index I plus environment that new line And then we close the fire stream Then we go to the the bang started the bugging We see the form We must press the first button Paris XML We see the values inside the textbooks from the nose inside the teams that XML file. Then we want toe press the button generate xml. But first we go to the form open containing folder being the bug and we have just teams that XML then we want toe generate the XML file file generated with success it appear new file that XML we press OK, then we see the new file, not XML, and we see the file. Then we want so save the XML file within the textbooks and we want to change. So Lakers, Lakers and save new file, too. Save. We have new five tool and the textbooks clear. Open, new file tool and it has open with the changes. 28. Slideshow Images App: Hello in this lecture will make us lie Show with images that will be display automatically or just manually by clicking on the image. Is this lecture is a bonus one? After that, we go to the properties. Well, after that, we go to the toolbox and search for picture box inside our picture box. We want to see the big image ease. Then we need from the toolbox A panel inside the panel. We need a truck bar and also a label we also need toward to the form a timer and also a button. Then we press on the truck bar. We go to the properties and change the orientation. The vertical The drug bar will maximize and minimize the images. Then the label one, we go to the text and changed the zoom. Then we go impress the time of one. Go to the properties and change the interval. The 2000 milliseconds or two seconds that the changes the image is automatically. And then the bottle. We change the text. So sly show. Then we enter on the surface code area and we declare a new library using system that input output for the directory file. with images. Then, inside our public class, we must declare the variables first. String square brackets If image ease that represents a vector with final names off images, then in n the number off images in I, X and I. Why represents the dimensions off little images than picture box? Be victor off little image. Ease that in pose the position off slideshow or number off the Keuren image. Bull merge. We said the own off off the slide show, then in W an age, the dimensions off, the big image with and Height. Then we create a function bleak that treat the click even for the little images or little picture box, Private void, Click Object Sender and even Uggs e. We treat the click event on Little Picture box for int I equals zero I less than n I. Plus plus. Then, if sender equal be off, I we'll see on which image it has been made. The mouse click, Then picture bucks one that load F image. Ease off I and said the position. The I. We love the images that were click on eight and said the position for each of them. Then we go to the forum. We double click on the form and it grates a function form one load Inside the function we said the F images Equal directory that get files and we want to take the folder image ease and all off the files inside the folder star with, ah, extension that J peg we go inside the containing further being the bug and we see we have a folder images that contain eight picture with not Jay paying extension. Then we returned inside the form one load and said the number off image ease and equal F images that ConEd then calculate the dimensions off little image ease I Why equal I eggs equal these that with slash and minus Then then we create the picture box. Victor, be equal New picture box off n Then we said the top for big image picture box That dope equal I Why plus 40. Then we said the height off the big image picture box one that hide equal These that hide minus i y minus 1 80 Then the weed picture box one that weighed equal picture box one that height multiply with four slash free. Then we said the big image to the center picture box, one that left equal 40 plus. These that with Slash do Miners Picture box one that with slash do And in the stretch mode , picture box one that size moaned equal picture box size mode that stretch image Then, if picture box one that left less than panel one that left plus panel one that with then picture box one that left equal panel one that left plus panel one dot with plus five. Then we said the button one to the center, but the one that left equal these dot with slash toe miners about the one that with slash stool than, ah, the down position. But on one not dope equal these that hide miners 70 and panel one that top equal I Why plus 40. We said the initial position oppose equal zero. The sleigh show off merge equal folds and the index for little images in I equal zero. Then, for every little image for rich string us in image ease, we create the picture box for every little image. Be off. I equal new picture box. Then we said the dimensions be off. I that with equal i eggs and be off I that hide equal I Why? Then we load the image from file Be off. I not load as the string s Then we said the top Be off. I not top equal 20 We said the left be off. I not left equal i x plus five multiply with I blast five and we said the stitch mode Be off I that size mode equal picture box size mode, that stretch image Then we other image on the form these that controls that and be off I We create the handler for click event on the picture box Be off I that click plus equal mule even handler off click and said the I So the next image I plus plus Then outside the forage we load the first image picture box one that load f image ease off zero first image And we said the initial dimensions w with equal picture box one that with and age equal picture box one that high. Then we go to the forum We double click the timer one inside the time On one take. First we move to the next image position plus plus then if position greater than or equal with the number off images and then those equal zero. If images are over, start with the 1st 1 Then picture box one that load F M E jeez, off pose. Love the image inside the picture box. Then we go to the form in double click on the bottom inside the bottom first if merge equal falls. If it is off, then timer one not start. We started the timer, but on one the text Equal stop show and merge equal through We said the mod as own else if it is on timer, one that stopped we stopped The time are but the month that text Equal Start show and Marge equal false, said the mod. As off we go to the form, click on the form events and so dish for resize in double click in the form one resize were resize the elements by dimension off the form just for little images. Then we calculate the dimensions for little images. I Why equal I x equal these that with slash and minors then then we come every little image for in I equal zero I less than be that count I plus plus and we changed the dimensions. Be off I that with equal i eggs Then be off I that height equal I Why? And we changed the left p off I that left equal i eggs plus five multiply with I plus five . Then for a picture box one. We copy these lines and we paste right here without the size mode and we doubt the 40 plus then for the button button, one that top equal. These that hide miners, 70 said the bottom down and botton one that left equal. These that with slash two miners about the one that way. Celeste toe toe the center and said the zoom panel one that dope equal I Why plus 40. Then we go to the form we click on the track bar. We change the value from 0 to 5 in double click inside the truck bar scroll, we declare free variables in zoom Equal Track bar one dot value minus five n w equals W plus zoom. Multiply 15 and in age, equal age plus zoom multiply 15. Then we said the new size picture box one that Klein size equal new size W and age, and we copy this lines. Then we go to the debug Started the bugging. We see the form first we want to go zoom in ends. Um out. Then we want toe start the slice show Stop the slide show, Click on the images And then we want to resize all elements the bottom state down The images are resized. 29. Listview and Treeview: Hello. In this lecture, we're talking about the concepts that we are using inside the least view review applications. We begin with Lee's View and three view complex visual contratos. If you information on a form is done in Varios formats. Hlynur Listsview Control and three Review Control viewing, Hlynur Listsview Control has the following viewing formats. Details. Large icon, small icon and least toward columns. In the least you control, you must access the property columns collection or directly from the code. Lee's view one that columns that add the column, the names off the columns are visible. Onley in details, view format. The elements of Ali's view are known as items, and the article objects off class. Lease view item. Liz You Control has a collection off items accessible through items property, which in turn contains a collection off soup items accessible by soup items. Property. If the object has the property lease view, Multi Select to True allows multiple selections off items it can treat item. Activate even processing one or more items. Selected toe Edit on item in the list view directly at runtime label. Edit property is said to true. To select the entire line full row select property is set to true 33 View Control Review Control is used to display a collection in the three form, with the possibility off expansion or compression levels in the three. Each note in the review is a three node class object. Each three note stores a collection off notes, notes that are related to a level on the tree. The main properties of the review. Our nodes, the collection off notes three note objects. Label edit indicates that dogs can be edit nodes. Selected node shows The currently selected known check boxes indicates whether each note will be preceded by one checkbooks. The main events off the preview are after select review. Class default even is triggered immediately after a selection off a node after label edit immediately after publishing label over node to validate the data enter after expansion immediately after expending a node. 30. Listview Controls (Part 1): hello in this lecture will discuss about Lee's view and how to work with it. Will other records toe the least view? So the columns change the four months inside and select the fields on categories. We are from the toolbox. First, a lease view. We double click. We're resize the form. Then we are from the Toolbox Image released Menu Streep and Context Menu Street. We begin by setting the properties for the least view. We go to the properties and changed the checkbooks from follows. True Doc, I feel grid lines through full row Select True label Edit through large image least image list and small image least image list and also view as details. Then we go to the image least. Click on the image least goto the Properties images collection and click on the collection Odd. Inside our project, these view controls being debug. We have to image electro Knicks Open and food open. Okay, then we click on the Context Ministry an odd one button view, then on the menu Street file, Exit button and view details. Small Icahn's large Icahn's Refresh a combo box and we want wad check boxes. Then we click on the check boxes go to the properties in search for Czech State and J checked through and check on Click Through. Then we go to the solution. Explorer Click the project Least view controls right click of the mouse on new Item glass, and we give a name product on inside the product class, we declare for variables. Public stirring name, Public Unsigned End Got They got e public Double prize and public Double I D. Then we want toe. Create the constructor Public Pro docked string Name on sign in Got They Go t Double Bryce and Double I D and said the names Name equal name category it call category price equal Prize an i d equal i d. Then go to the form. Click on the lease view, then inside the properties search for columns. Click on the collection. An Odd Free Columns for US column. The text. We changed the product. The second column Price product in the third die off productive. We arrange the columns. Then we go back to the solution. Explorer. Click on the project Lease view Con trolls, the right click of the mouse, odd New I thumb glass and the name sort rapper on inside the sort rapper class. We declare a new library using cease them, not Windows that forms. Then we declared two variables internal least view item sort item, an internal in sort column. Then we create the constructor public sort rapper least view item I thumb and in I call them the index off the click column sort item, equal item and sort column equal I call them. Then we said the takes property, forgetting the text off an item Public string text get return sort item that sub items off sort column that fixed. Then we said the implementation off the interface Compare er interface for asserting ray least items public class sort Compare er he hurried by system that collections that I compare inside the circum patter class. First we declare a bull variable ascending. Then we said the constructor that requires the sort order through if ascending, otherwise descending public sort Comparator Bull A s C. These that ascending equal sc Then we said the implementation off the interface Comparator he hurried by Compare a method for comparing two objects Bob Leak in a camper object eggs object why and the inside sort rapper ex item equal sort rapper Eggs and sort rapper. Why I thumb equal sort rapper. Why, then said toe stirring variables, string X text, equal eggs item that sort item that serve items off eggs Item that sort column that text and string. Why text equal why I thumb that sort item that serve Items off why I thumb that sort column that text and return eggs Eggs that compared toa Why next multiply with these that ascending, then one else minus one. After that, we go to the Assertion Explorer and create another class Odd new item Class column Heather , call Heather on inside a call Heather Class. First we harried the class from system that windows that forms that column head there, Then inside the class public bull ascending. Then create the constructor public call Heather string next and with system that windows that forms that horizontal a Lyman, a line and bull ascending These the text equal text these that with equal with these that text align equal align And these that ascending equal s C. Then we go inside the form. We press F seven on the keyboard and we enter on the source code area we declare a new library using system that collections for using the array list. Inside the public class, we declare array least least off products and initialize the instance at least off products equal new array list. Then we create a function for initializing the least with products. Private void initialize the least least off productive that ad new product and said the name radio device. The category zero than the price. 120 then i d. One least off productive. That ad new product. The name Mobile phone. The Category zero The price free 20 and i d least of products that ad new product. Best grids Got degree one price. 1000 i d. Free then, least of products that ad new product. Some issues. Category one price. 140 i d. For least a productive that and new product name drinks. Category one. Price. 200. Then i d five. Then we want to create a new function for generating the least view. Private. Avoid generate least view. Least view this view. Listsview that columns not clear with clear the columns. Then we want to change the columns off the headers for the least view in order to do that, we're right. At least have you not. Columns? That ad new goal had the off pro docked with is Toe 10 and horizontal alignment that center . And for sending through then, least view that columns that ad new coal had there off brize with 1 20 or resentful alignment center and ascending through and least view columns that and new called Heather off type 1 45 Horizontal Lyman Center and Throw. Then we need to create another function in orderto add the productive inside the least view private. Avoid initialize, at least view. First we clear the items from the list view. Please view one that items not clear. Then for each, for every productive, inside the least off products product. Pro docked in least off paradox. Then we create an instance off the least View I thumb item. Equal new plays view item off product, not name end productive that category. Then item that sub I terms not add productive that price not to string item that soup items that ad productive, not category that the stream and item that's of items that ad product, not i d that the string and at the item please view one that items not add. The item will continue on the next lecture 31. ListView Controls (Part 2): hello in this lecture will continue by setting the types off four months. If we select the product from the least view, we change the color, and if it is clicked, we show a message, said the selection for categories and said the older When we click the columns, we great. Another function for initialized. The combo box selection. Private Void Initialize Combo Box Soleil. Shown inside. We create the options string options equal Choose selection the first option second option electron, ICS and food. After creating the victor off options, we said the Tool Streep Combo box one not items that odd range the options and the street combo box one not selected index equal zero meaning we choose selection in orderto display these functions inside the least view. We must call them inside the main function public Form one. We go to the public form one, and after the initialized, the released first initialize the least, then generate leads. View these that lease view one, then initialize Lee's view and initialize combo box solution. Then we go to the form view and double click on details, then double click on small icons. Large I, gauze Refresh and Jake eBooks ease. Then we said the display Four months for the least view. We begin with the details least view one that view equal view that details then, for the small icons least view one that view equal view that small icon least view, one that view equal view. That large icon inside the refresh button, we call the function initialize lease view, then inside the check boxes. Barton. We want to sit if the check boxes are checked or not. If Jake books towards three menu item that checked, then least view one. That check MOCs is equal through Els. Least view one that check boxes equal false. Then we go to the form. We go to the file and double click on the exit button. Then on the context menu, Streep and double click on the View button inside the exit button application that exit and inside the view button for every item inside the lease view for reach, least view item item in least view one that items. Then if item selected, then we bring the message box that show item that next, plus stirring it was selected. Then we go to the form we click on the least view. We go to the properties events double click on the select in the exchange. Then we go up and search for column. Click and double click, and we need item Activate then inside a select in this change for every item inside the least view for each least view I thumb item in lease view one that items then if item not selected, then item not for color. Equal cooler, not green tells item that for color, equal color, not black. Then inside the lease view item, activate for every item inside the least view that is selected for each least view item item in least view one that selected I thumbs, then message box, not show. I don't not text, plus stirring it was selected. Then inside the column click. First we create an instance off the column Heather Class and get the columns. Call Heather clicked. Call equal. Call Heather. These that lays view one that columns off e dot comb. Then we get the number off items in the least and numb I thumbs equal. These not least view one that items not count. Then we turn off the display while that eyes repopulated these that least view one that begin update. Then we want to populate on a released with a sort wrapper off each item. We great an instance for array, least, sort array equal new a released then for each number off items for in I equal zero i less than numb items I glass plus then sort array that and new sort rapper off these not least view one that items off I and he not call them. Then we want toe sort the array sort array that sort zero then count, sort array that count new sort rapper that sort compare er off click column that ascending . Then we clear the least and repopulate with asserted items This that leads view one that items that clear. And for in I equals zero I less than numb items I blast glass These that leads you won that items that ad cert rapper sort array off I that sort item. Then we need toe turn the display back on these that least view one that n update We need toe create one more function private avoid selection category, object sender and even dogs e inside the function we want to select the item from two categories off products, and if the item is selected, then we change the back collar. First we declare two variables. String as category selection category, equal empty, string and end and cut degree the number off categories. And we said as minus one. Meaning is a default value. Nothing selected then if ST Combo Box one not selected index greater than zero, then selection category. Equal told Strip combo box one Not selected. I thumb not to string. Then we switch the selection category. Switch has got degree. Case electron ICS and category equal. Zero break in case food in category. Equal one break and default break the selected item. It sets the currently item minus one for default value. Zero for the first productive chosen and one for the 2nd 1 Then for every item inside the least view for each least. View I thumb item in Lee's view. One not items. If item that sub items off. Do the third and got agree equal one. Food that fixed not equals with n cart. Agree that to string, then item not back color equals color, not gold. Ellos item that back color equal colon that white else. We want to set the default color back color as white for Rich Els. For reach least view item item in Lee's view. One not items item that back color. Equal color, not white. Then we want toe. Activate the select in the exchange by coping the name off the function. We go to the form Click View and go inside the events. Select in the exchange and put the name selection category. Then we click on the lease view, go to the properties and search for Context Ministry and activate. Then we go to the debug Started the ball game. We see the form first. Small icons, details, large icons, shake boxes, wheat Jacobo Kesey's than details. We click on the column product. We sort the productive by price and by type. Then we double it. Leak on the product. A radio device. It was selected. Then view mobile phone. It was selected. Then we choose the selection. I think thrown X and we have the back color off gold or food bicolor off gold refresh and exit 32. Controls TreeView App: hello in this lecture will discuss about how to work with a preview, will populate the review, delete a node, refresh the least off nose and select a note and display values inside a textbooks. Contra First will resize the form, then go to the pool boats and search for review and said the review. Then search for thanks. Boats, we said as multi line then we need a image least in the Context Ministry. Inside the Context Ministry, we had two buttons, the lead and refresh. Then, inside the image least, we go to the properties images and click on the collection and odd to images inside the project. Three view controls being the bug. We had electron ICS open an odd food open. Okay, then we click on the review. We go to the Properties, search for Context Menu Street and activated and search for image least and activated. Then click on the text books, go to the properties and change the name. Toe takes books, values and heat enter. Then we go to the solution Explorer. We click the right click off the most on the review controls on new item glass, and we give a name product on inside the product class. First we declare as public. Then we declare for variables public string name, public, unsigned end category, public double, bryce in public, double i D. Then we create the constructor, taking the name off the class product String name unsigned in category, double price and double I D and said the names name equal name category, equal category price Equal prize and I d. Equal I d. Then we go to the form. We click on the form we press F seven on the keyboard and enter on the source code area. First we declare a new library using a system, not collections, for using the array list. Inside the public class, we declared the rail east least off products and inside the public form one, we initialize the least off products equal new array list. Then we create a new function. Private void initialize the least by taking the least off product array and add the products. New product. We take the name off the constructor and name radio. Devise the Category zero the price 120 and I d one then leased off. Productive, not and new product. The second product. Mobile phone got degree. Zero price. 240 and the i D to then least off products not add new product. Miss Creeds. Then Category one Price. 520 i d. Free at least off products, not add new products. Serve dishes. Category one Price. 320 i d for and the released off products That ad new product drinks Got degree one price. 220 and i d five. Then we great. Another function. Private void Initialize three view and inside the function. First we cleared the nodes. Three View one that nodes not clear. Then we create a new node. Three node new node equal New three node with the name Electron ICS. Then odd the node inside the review nodes. Odd new node, then for each pro duct pro duct in least off products. If product that category equal zero first category. Then we create a child node three known child known equal new three node product that I D plus miners plus product that name plus product. The prize then said the Children in productive that category and selected image index in productive that category. Then we want toe. Add the child node to the new node that nodes not add child known. Then we need to add one more node. New node equal New three node food, Children one and select in Mitch Index one, then three View one that knows that ad the new known. Then copy this for Rich I'm based here and instead off productive that category equal zero equal one. Then we want to see all the child nodes has expanded three view one that expand all. Then we want toe display these two functions inside the review and we take the name off the functions and called them inside a public form one. First we take the initialize the least and call inside the public Form one and initialize three view. After that, we go inside the form Context Ministry and double click on delete and then on refresh then inside the belief button. First, if three view one that knows not count greater than zero if exists, nos then three node node seem like deal equal. Three View one that selected node. Then if review one not selected node Not next node different than no node selected equal three view one that selected node that next node Ellis If review one. That selected node that previews known different than no knowed selected equal review one that selected node that previews node. Then we want to remove the selected node Review, one that selected, known, not removed. Review one. Not Selected node Equal Node selected. Then inside the refresh bottom, we simply called the name off the function initialize three of you. Then we go to the form press on the three view. Go to the Properties events in double click on after select, then inside the preview, one after select. First we declare a variable string i d. Equal empty string. Then, if three view one that nodes that ground greater than zero. We said the three node node see like did equals three. View one not selected node then, if knowed selected, not barren, different than no i d. Equal node selected that text that split with miners off zero. Then after we said the separator for reach pro docked pro docked in least off products. If product that I did that to string, that equals I D that we take the textbooks values that text equal product that name plus productive, not price, plus a string hero else. If no selected that parent equal no. Then textbooks. Values that text equal and destroying. Then we go to the debug started the bugging. We see the form when we press on the food and the electron ICS because they are the parent nodes. Inside the textbooks values we show a empty string. We press on the child node and we see the product name and productive price in the string for each child node. Then we want to delete a child node. Then we want to refresh them. Then we see the old three view. 33. Listview Insert Products: Hello In this lecture will insert records in Elise View, Make two forms in first form. We have a list view when we show the records inside and in the second form, we had fields toe the first form. First we go to the toolbox and add a lease view. Then we had a menu. Streep inside the menu Streep We had to butters insert they, uh, and exit. Then we click the least view. We go to the properties, change the duck. I don't feel full rose. Select through grid lines through and the View as details, and then go to the columns and change the collection are three members. The first column. We change the text, the name, the second column, the quantity in the first column, the price. Okay, then we arrange the columns. We go to the solution Explorer. Create the right click of the mouse on the project. Odd new item glass, and we give a name product on inside the productive class. First we call public class product. Then inside we declare for variables public studying, name, public in quantity, public in price and public in I d. Then we create the constructor public product staring name in quantity in price and in I d and said the names these not name equal name these that quantity equal quantity This that prize equal prize. And this that I d equal i d Then we go back to the form one. We go to the solution. Click the right click of the mouse. Odd new item windows form with the name off form to on inside the form toe we goto the elbows. An odd free label free Thanks. Books, con throws and two bottles and also on error provider. We have one button copy paste, two buttons, then free labels and free Thanks Books contratos Then we named the Controls Forest label. We go to the properties text and changed the name second label the quantity in the first label the prize and also the textbooks control We change the name first take spokes Name second thanks. Boats quantity And also thank spokes price and the butter's. We changed the text though. Okay? And cancer. Then we go to the form. We press f seven on the keyboard and we enter on the source code area. Then inside the public class, we create a least off objects. Product at least off products equal new, least off product. Then we create a function that loads that that are the least by giving values and using the constructor created in the productive class. Private void, load least off products. At least pro docked a least. And we had the products toe a least a least, that ad new product. First, the name sugar wanted the five Price. 100 i d one, then a least not add new product cookies. Quantity seven. Price. 200. I did, too, on a leased that and new product vegetables. Quantity. 15. Price. 300 i d. Free then we greater function that the loads that are from the least inside our lease view . Private void load least view First, borrow matter least view LV in the second least off product, a least inside the function. First we clear the items LV that items that clear. Then, for each product road in a least, then we create an instance off the least view. I thumb I thumb equal new lease view item, then item that soup items off index zero first element that text equal product, not name, then item that sub items that ad product, that quantity not to string. Then item that soon items that ad product that price. And we said as to string but plus a m festering, then item not serve items that ad productive that I d. That to string. And then we are the item inside the least view. Please view that items that ad the item. Then we take the name off the functions and call it inside the public form one inside here in orderto display the records inside the least view. First, we take the low least off products and said the parameter list off products and load least view with least view one and least off products. Then we go to the form, press the menu Streep file and double click on. Insert that on, then double click on exit button before we insert the data. Inside the least view, we goto the form toe. We press F seven on the keyboard. We end around the source code, and inside the public class, we declare a variable private product road equal. No said that's no, and also we want to set the property public pro duct product, get return these that road. Then we go back in the form one. First we declare a dialogue result deal G. Then we create an instance for the firm to f toe equal new form toe. Then we said the deal g equal f toe that showed the olive method. Then if the allergy equal dialogue result that okay, we served the product in the least. If if I do that product different, then no, then this that least off products that ad. If toe that product load released view at least view one and least off products then we release the resource is f does not dispose, then inside the exit button application that exit. After that, we go inside the phone toe and make the validation for the imports. M parse the data that will be sent for the form one inside the least view, we create a function that validate or handle the errors from the textbooks Inputs private bull validation. First we create a bowline flag bull. Okay, And we said as true return. Okay, but first, if thanks Books name that takes not linked less than three characters. Okay, We set the falls and a provider one that said error. Thank Smokes name and the steering at all. Insufficient corrupters. Els and our provider one set error. Thanks. Books Name an empty string, then, if takes books. Quantity that takes that length equal zero. Okay, we set the falls and or provider one set at our textbooks quantity and the editor string Wrong quantity else and or provider one said error. Thanks. Books, quantity and empty string. Then we need toe. Parse the data. First we declare two variables in price. Equal zero and quantity equal zero, then dry quantity equal in 42 not pars. Thanks. Pokes fun teeth. E not text and said the error provider one said Ahrar textbooks quantity don't empty string and price equal in 42. That powers thanks Boc's price that text and also said the other provider said error textbooks price an empty string after setting the errors. In case we do not feel we takes the textbooks, controls and parts the data inside the try look in the catch block. We need to set the errors in case we enter inside the textbooks letters because we said just for numbers Gedge the exception. We said the okay to folds and ed or provider one. Set error textbooks. Quantity in the error string. Wrong quantity and ed or provider one Set error textbooks Price and Rome Price. Then we go to the form toe and double click on OK button and also the cancel button inside the button. One first we very find the validation. If validation equal through, then we parse the data in price equal in 32 not powers. Thanks. Books price, not text string name equal textbooks. Name that text in quantity equal in for Tito that bars textbooks quantity, not text. Then these dot product equal new product the name, quantity, price and said the I d to one. Then we said the these that dialogue result equal dialogue result that Okay, Els this the product equal? No. Then inside the button to this that dialogue result equal dialogue result that cancer. Then we click on the bug start debugging. We see the form and the records inside the least view. First we goto file insert that Tom, we press cancel and we return to the first form. Then insert data. We go to the second form. We press okay and we see the errors, insufficient characters, wrong quantity and wrong price. We are a productive drinks the quantity 12 in the price. 400. We press OK and the productive has been inserted. We are one more freed's quantity 24 and price 500. We breast OK and then file exit. 34. ListView Insert Books (Part 1): Hello. In this lecture, insert records least view toe the same as the previous one. The application is divided in three parts. First, we need the main form form one where we process the data save and open the file and put the records inside the least view. Secondly, we create a books class where we declared the variables for the inputs in the textbooks controls and create a constructor to set the variables that we work with. Lastly, we need a new form at book that contains all the labels and text books controls. We parse the data in order to send it inside the main form By pressing the button. First will resize the form. Then we go to the little box and search for lease view. Then search for menu Streep Inside the menu story We are free Butters File Save open and exceed. We also need from the total votes a group books This group books holds the radio bottles. We are for Radio Butters. We also need a bottom. Then we name and fill the controls. We begin with the least view. We goto the columns collection and odd several members. Forest COLUMN The text is cold. Second outdoor, then title year Publisher Price A 90. We press OK, we arrange the columns. Then we named the group books. The text changed to view in the radio Butters First details the second large icons Next Small my Guns and finally at least also named the bottom Odd book. We go to the phones and change, though 14. Press OK, then we go to the solution. Explorer. Click the right click of the mouse on the project on New Item Glass, and we give her name books. Odd. First we said the books class arse public. Then, inside the class, we declared the variables public in Gold Public String Outdoor Public String, Daido Public in a year, public string publisher, public in Brize and public end I D. Then we create the constructor public books and code string outdoor steering title in Year String Publisher and Price. An ent i D. And say the names goed equal C. Outdoor equal. A title equals the year equal. Why publisher Equal be price Equal beer and I the equal I d. Then we go to the Form one and press F seven key on the keyboard, and we enter on the source code area. First we declare a new library using system that input output for saving an opening a file . And inside the public class, we create a new object off the class public books book and sit and get the property get and said, Then we go to the solution. Click the right click of the mouse. Our new item when those for form toe we change with odd book on inside the art book form we need from the toolbox toe ad seven labels. Seven textbooks controls in the bottom. We expand the textbooks con throws we copy six times, then the label. Six time. Then we named the labels We goto properties and change the text first. The code label, too. Our tour label free title label for year label five Publisher label. Six Price and lastly, I D. First, we must ling the forms. We create a private variable form one get form, and inside the odd book, form one said form and make the get form equal to set form inside the bottom one when we click the bottom, if there is empty space inside the textbooks controls, we need to do nothing, meaning not to crash the application without using the error provider. And then what is the data? And send it to the form one first, if thanks Books one. Not text. Equal Empty string or and we copy six times one to free for five six and we changed the textbooks. Oneto take smokes toe Thanks Books free. Thanks. Books for five, six and seven and then we give a return statement. Then we use a try. Catch Blog's exception. Thanks. Inside the try block, we parse the Tom get form, not book Equal New books First is the code in that bars Thanks books one. Done next. The second is outer textbooks toe, not text. The third is the title textbooks. Frida text, then is the ear in that bars off textbooks for not text, then is the publisher take spokes five dot text, then is the price in that bars? Thanks Books seeks not thanks. And lastly, Di di in the bars off textbooks seven. Not text. Then inside the catch block, we said the error. If the import data is not on the correct for month message books that show and on input they dumb X that message and message box buttons that okay and message box icon, not error. Then when we feel the textbooks with correct data, we need toe automatically close the art book form and send the text on the least view inside the first form. So we write these that close. Then we go inside the form one and press double click on the add book button. Then we go and double click on each radio bottles, details large because small, I cause least and also the menu Streep save open and exit. We begin with the first bottom, but in one click inside, we create an instance for the form to at book F two equal new art book these. Then we showed the DIA log for form to we Great. Ah Bullen, Flag bull. Okay, we initialized the falls and we created in index it called to zero. Then for reach least view item LV in Lee's view one that items if l v that soup items off index zero that text equal book that code that to string Okay, we said too true. And the index equal least view one that items that index off the instance LV then if it is not okay, we create an instance for the least view item. LV equal New Least view item and said the book That title That the string. We set the view as title when we check the radio buttons, then we add the sub items Duck ad book, not outdoor. Then we said the LV dots of items that ad book that year, the two string of the that Some items that ad book that Publisher V That's items that an A book that price that to string vidas of items that ad book that I d. That clustering and we are all toe the lease view on that. Items not add L v. Els. We said the least view one that items off index that soup items off index one the second Ellemann not text equal Book that outdoor. We copy this line and paste it five times and change the index toe to toe free 45 and six. The index and we want to change the outdoor toe title. Then toe year. The two string, then publisher, then price not to string. And lastly, Di di not just ring. We continue on the next lecture 35. ListView Insert Books (Part 2): hello. In this lecture, insert records lease view toe, part toe. We'll focus on display in the records inside the least view by selecting a radio button and said the view. Then we saved the fields from the least view, split by a comma, using simple text without using including or serialize it like we do in the Privy owes applications. And we also open the last safe file. First we take the radio buttons. We begin with Radio Button one least view that view equal view that the Day Lis, then the second radio button least view one that view equal view. That large icon, then least view one that view equal view that small icon and in the last radio button lease view one view equal View that list. Then inside the safe button, we need toe use a try catch blocks inside the try block. We create an instance for The Stream Writer F equal, New Stream writer that has to arguments the file that way right in books that takes them and the encoding we said as false then for each item from the least view for each Lee's view item LV. In Lee's view, one that items we take every item from the list view and right inside the file we take the instance for the Stream writer f that right line and take the first item. So I thumbs index zero that text plus comma plus and take for each off the seven items from the list view. We copy these and based it six times. Then change the index one do free for five in another one six. Then we close the stream writer if that close and outside the dry we said the catch And inside the catch Brooke, we called the message box that show it cannot, Right? So the file, then inside the open bottom, First we clear the items from the least view items that clear. Then we use also a try catch block inside the try block. First, we create a instance for the Stream reader F equal new steam reader with one barometer. The file that will be open books not takes they Then we create a new variable string are from read equal f that read line. Then while enter different from no, we create a string victor effect equal air. Read that split and take the comma, then we great the least. View I thumb L V equal New lease view item for the verdict. Lee's view one that items that ad the least viewer and are equal f that read line. Then we need toe close the Stream reader. If that close. Then inside the catch block, we simply said the error in a message box that show the file cannot be open in the last bottom exit bottom application that exit before we run the program. We forgot, though, right? One line after our door we need the title book, that title, and when we change the radio bottles, we show the records from the least view by the title off the book. Then we go to the debug started the bugging. We see the form first we open the file and we give an error. The file cannot be open because we don't create the file. Then we add a book to the least view. Odd book. The code. Want to free the outdoor? When did the, um, shake Spear the title? Hamlet? The Year 1600. The publisher, Simon and Schuster. We copy the publisher. The price. $30 I d one said. And we have the record. We had one more. The code is 1 to 4. The outdoor is Harriman, Melville, the title Moby Dick, then the ear 100 nine 12,900. The publisher Simon and Schuster Price $40 I d toe send. Then we see by the details large. I cause small I cause and the least we also want to save the file se and then close the application and run again. And we want to open the file. We see the records, then we close the application. We go inside the open containing Folder Bean the bug, and we see the books that takes their file. We open the file and we see that every record is splitting by a comma. 36. Add & Remove & Visualize Records: hello. In this lecture, inserted records least view free. First, we need a main form form one where we make a link to the second form and also visualize the records inserted on the second form by a defined type. Secondly, we create a travel person class where we declared the variables, create the constructor and said the properties. Leslie, we need a new form. Odd persons where we add more controls. Group together Remove records from the least view we need from the toolbox a menu stream inside the menus. Three. We set the purser's first bottom on better sores and second button Visualize better sons. Then we go to the solution Explorer or on the project, create the right click off the most odd new item Windows form on Paterson's, huh? Inside the perseverance we need to add from the toolbox for group books, two of Bottles and the Listsview, the lease view, the first group books, the second group books, the third group books and the four group books and two buttons in the lease view. Then we must maximize the form and the lease view, and also inside the group books we need toward radio bottles first radio bottom second and in the second group box for radio bottlers inside the free group books to check box controls. Then, inside the four group books, we need to add seven labels and we need to add a combo box and six textbooks, controls the Kama box in the textbooks, control and maximize the bottoms. Then we name all the controls first group books We Goto Properties and change the text to Gender and inside Radio Button one we set as Gentleman and also Lady. Then inside the group books Toe we said as age that radio about them free. We change the text, though. Zero the 12 then 12 to 18. Radio button on five 18 2 45 in the last radio butter 45 plus. Then inside the group books free, we said to the text The options in the options are business and also Toxie. Inside the group books for personal info and the labels we said the labels. But first we arrange first the textbooks controls and then the labels. First label we set as I de then code last name first name Enable five we set as sit number . Take it number in the last label said as price. Then we said the button one toe ad and the fund to a 14. Also for the second button delete in the fund the 14 then for the least view. First we check the full row select to true grid lines. So true and also view as details and said the columns, columns collection are then columns. Forest COLUMN We said the text to gender. Call him too Age then options I d. Goed Last name first name sit number A ticket number and also price repress. Okay, then we arrange the columns. We maximize a little the least view. I think a number said number first name last name then inside the personal in for group books I d On the combo box we go to properties items collection An odd free rose one toe every your breasts. Okay. After that, we go to the solution Explorer, Click on the project. Right click of the mouse. Odd new item. Glass. Let me give her name. Travel person Bond. First we said the travel person class as public. Then inside the class, we declare the variables private in i d private in gold private string. Last name, Private string. First name, private in seat number, Private in Take it number and private float price. Then we create the constructor Public travel person End I D in code string. Last name string first name in seat number and a ticket number and float Price and said the properties I the equal I d code equal C last name equal last name, First name, equal first name, seat number, equal sit number, ticket number, equal ticket number and price Equal price. Then we need to set their properties public and I d get return these that i d and said these not i d equal value copy these six time and said the second is the code returned. This that gold is that code value. Then said the next one string last name And also this that last name, then stirring first name this the first name, then in seat number. These not seat number, then thinking number this the thinking number and also float price these not price. Then we go to the odd person form with our click on the art bottom. Then we click on the D League bottle. Then we go to the least view president is view Goto events stop and double click on select in the exchange before we begin with the bottom one. First we declare a new library using system that collections in orderto work with a released inside the class, we declare a variable private array, at least least off people. Then we declare another variable private least view item. I thumb Please view the list off people of released. We use it for adding a row inside the leaves view and the list view item item listsview we use for the leading a row Inside the up Persson's form. We are the new variable array, least at least off people. And after initialized component, we said the least off people equal least off people. Then inside the button one first we said the string gender equal male. Then if these not radio button toe that checked, then we said the gender equal female. We also said the interval string interval equal default value 0 to 12 years. Then if these that radio button for that checked interval, we said 12 to 18 years. If these the radio bottom five that checked interval equal 18 to a 45 years else. If this radio button six not checked interval equal 45 plus years, then we want toe set the check values string check value equal, Empty string. If these not checkbooks one that checked Jake Value plus equal the business else. If these that checkbooks to that checked Jake Value plus equal plus taxi, then we will declare the variables that will add inside the lease view. First string I d. Value equal. These that combo box one that text string code value equal these the textbooks one that text, then string last name value equal. These that takes pokes through that text string first name value. He called these the textbooks free that text, then string seat number value equal. These that takes books for that text string. Take it number value equal. These that takes books five that text and string price value equal. These that textbooks. Six. That text. We'll continue on the next lecture 37. Insert Records ListView: hello in this lecture will add the variables created in total eastview. Delete the items selected from the least view and change the color off the row if it is selected and also will make the link from the first form to the second and visualize the person's added to delays. View First will create a least view item. Instance. Item equal new lease view item and set first the gender, then item that soup items. That ad we said the interval I thumb that soup items that ad. We also said that chick value. Then we copy this row and add seven more items. The first item i d value the second code value, then last name value, first name value, seat number, value, ticket number value and also price value. Then we are all the items inside the least view one these that leaves view one that items that ad the item. We also need to create an instance for the travel persons class and other default values Inside the array Travel person Be equal New trouble Person first is I d convert do in 32 i de value then the code convert toe end 42 code value, then last name value, First name value The seed number zero the chicken number zero in the price one. And these that least people not add the person. Then inside the button toe delete button. We need to delete the item from the lease view. These the least view one, not items not remove these that item lease view. Then inside the least view one select index change for reach least view. I thumb l v i in these that at least view one that items if least view item that selected this that item plays view equal lease view item And these that item leaves view that for color equal color that red. Then we go to the form one and click on the menu Streep Persons and double click. Then on the visualize better service. Before we begin with the bottles, we go inside the libraries and add one more library using a system, not collections. Inside the class, we declare a new variable, private array, least least off people. And we said us no. Then inside the public form one after initialized component, we initialize the array This that least off people equal new are released. Then inside the odd persons we take the name for the form toe odd persons f for form equal new odd Persson's these that least off people and form f not show the dialogue Then inside the visualized persons we count the persons If these that least off people different then no meaning if exists at least one person for int I equals zero I less than least off people that count I blast plus Then we print with a message box message boats not show, we said and string plus travel person this that least off people off I every person that a defined type last name You go to the debug started debugging We see the first form visualized person week leak We don't get anything because we don't have any person. Then at persists we showed the second form We select gentlemen 18 to 45 age options Business di D one code 100 Last name LeBron First name James said number 20 Free ticket number 1000 Price $300 on Then we add one more The same gender age and options we select i d Do code 101 Last name Bryant. First name. Cobi Sin Number 24 thinking number 1001 and prize the same on. And also one more code 100 to last name Antoni. First name. Carmelo Sid Number seven, Thinking number 1002 The same price on We Select one row and it transform into the red color We Jake a row with Elite and second, and then we close the form and see the person's LeBron Bryant and Anthony. 38. Listview Show file types details (Part 1): Hello. In this lecture, least view show file types will make a least view that show us the files from the computer or our project. The files display in different formats. We can choose the path the location in our hard drive. We select the path and show the files inside the least view from the form. We also open the files with different file extensions. First, we'll add from the toolbox. A lease view would maximize the form, then maximize the least view. Then odd, a button label and the combo box, the bottom the Kama box in the label. We change the text off the label. One to show the Kama box, we said Inside the properties. Drop down style toe drop down least in the bottom. We changed. It takes tow. Choose directory. We pressed the combo box. We go inside the properties items collection and inside the collection, first row big, then the second row tiles. Then small. I cause least and the dales we press. OK, then we go inside the toolbox and add a few more controls. A image list, another image least the 2nd 1 in the folder browser. The dialogue we pressed on the image Least one we go inside the properties images we press on collection on a new member. We go inside our project being debug and we have these images first we odd dog not PNG Then Jay Bang open then thanks there. Oh Bun then no type open then any open B and G Oh bun html Oh bun and PPT open we breast. OK, then we delete the image least toe and copy and paste the image Least one into the image least toe and we have the same collection. Then we go inside the cold sores. First we declare a new library using system not input output for files informations first inside the public class we declare a new variable in and that means number off files. Then after a public form one, we declare a new function public string short name, string as that return the file name in I equal as that Lang minus one, while as off I different than slash slash the Della meter. Then I minus miners and return as that sub string off I plus one. Then we create another function for ah returning the extension of the file public string said Extension string as we declare a variable in I equal s that length miners one while as off index I different than a dog. Then I minus miners and return as that sub string off I plus one. Then we go inside the form. We double click on the form one load. Then we go to the bottom in double click, and we have brought in one bleak, then combo box. Select in the exchange. Double click. Then, on the least view, we need the bleak in double click and also the double click Double click inside the Form one loan. When we enter under the bugging mode, we need to see the icons in a specify former as a default setting. Lee's view one that small image least equal image least one for little icons, then lease view one. That large image least equal image least toe for big icons. Then lease view one that columns. That ad. We are the column name, file name, then lease view one that columns that ad, the extension, the file DYP. Then at least view one that called, um start and the dimension No, I mention in bites be then we said the default setting as big icons Combo box one that text equal combo box one, not items off index zero. The first item. The first row that to string inside the button. One click we said the People Bad Folder browser. The Olive one that selected bad equal application that start up bad then, if Folder browser, the our loved one that show the dialogue equal the dialogue result that Okay. First we empty the least view these view one that items that clear. Then we said the chosen folder, the directory, creating a string variable there Equal folder browser dialogue, one that selected bad. Then we create another string array number off files equal directory that good files off directory the path. Then we count the number of files and equal and files that count than Lee's view. I thumb array l the I equal new least view. I come off and we create an items for the least view. Then we create a variable I equals zero, then lease view one that view equal view that large icons, we said the dutiful big icons, then lease view one that begin update for modifying inside Ali's view then for every file name for Reach String as in n files, we create items for listsview LV. I off. I equal new lease view item. Then we choose the image after extension Switch extension shown. Set extension off asses. We begin with a case, Doc L v i off i that image index equal zero l v i off i that soup items that ad word document less or equal with 2000 free and break. Then we copy this line and paste it nine times For the second case. We said the eggs the image index zero were documented greater or equal with 2007. Then next one, we said, That's ppd. The image index we set as seven and Power Point document less or equal with 2000 free then b b the eggs index image seven Power point. No common, greater or equal with 2007. The next case, we said cause J bag the Image index one and the string text. We said that J peg image. Then the next case, we said, as the X the image index do and the string text file next, gays any image index we said before and the text is any file. Then for the next case, we said That's being G the image index. We said, That's five in the string text B and G image. Then we said as H T. M the Image Index six and the text html page. We copy these line and we based it for HTML then gays. The last case is before the image index. We said so free and the string next unknown type after, which is image off the extension. We said the information above the file with the name s file info F I equaled new file info as then l the eye off i that soup items that ad if I that linked not the stream plus bites we they the dimension in bites. Then we take the final name l v I off. I that text equal short name off s and added to the list view raise you one not items that an l v i off I. Then we said the least view one that end update toe end, modifying the lease view. We'll continue on the next lecture 39. Listview Show file types details (Part 2): hello in this lecture will continue to work on Combo box Select in exchange, we said the former inside the least view and also when we click or double click the icons from the least view, we opened them with the specified program. Inside the combo Box one Select. In exchange, we want Toe choose the display moved off elements from police View. We make us which combo box one, not Select Index Selected index First case zero least view one that view equal view that large I Gone break in case one. Lee's view one that view equal view that dial and break case two least view one that view equal view that small i gun break case free. Least view one that view equal view that least also break in case for please view one that view equal view that details then, for the details view we want, Toe said. The weed off the columns, please view one that columns off index zero first item not with equal 150 than these. View one that columns off index one that, with equal 100 and also the least be one not columns. Off index tour not with equal 100 and we want to set the fourth column. Lee's view one that columns off door that takes a line equal horizontal a Lyman, the right and also the break. Then inside the least view one bleak. First we said those selected items. If Lee's view one that selected items that count greater than one, then for and I equal zero I less than leave you one that selected items that gown I plus Plus we great a variable that take the final name string as equal least view one that selected items off I that text and another variable that take the path through the chosen further string. But equal folder browser dialogue one not selected bad. Then we choose the program by extension. Switch said extension off string s than case takes them ceased them that the agnostics not process not start. We take the first program note bad then the bad plus the limiter slash slash plus the string s and then break then with a copy this line 10 times. Then we want to set the next case the dog in the program. When word next duck eggs in the same wean word then PPT in document Power point PPT eggs the same power point then J peg in the program M s pained then PNG the same m s pained than any in the program. No bad then HTM in the program Fire folks html and the same fire folks in the last line We said as before a message box that show unknown DYP Then inside the least view one double click we take the fun name String as equal least view one that selected items off index zero that text and the pat through the chosen fuller string. But Equal folder browser dialogue one not selected bad. Then we choose the program. By extension, we copy this switch on base inside. Then we go to the form press on the image least toe and change the size with and hide So 48 then in orderto said the size for the large icons we goto the images collection and remove all then on dog open Uh, J Pang open with a different size. Odd. The next one is takes there open no type open Odd inning open on B and G Open on html open odd be BT open. Okay, After that, we go to the open containing folder and inside the folder we see the further that is one word, not many words. Then we go to the bean. The bug we create a new folder files these files we have, as takes test documents that we need to open when we click on the icons. Then we go to the The bug Started the bugging. Choose directory. We browse for the folder The bug. We see the folder files. Okay, We see the big icons. We changed the tiles, then small because at least and also details. And we want to open the files first. J peg for the J peg. We open with m s. Pained than the document X with Office 2007 index that HTML we open with fire folks and we see the text welcome two c sharp than the lease view that PDB unknown type. Some text not takes day. We know bad PNG, a PNG with pained and also the any with no bad 40. Treeview Show file types details (Part 1): hello. In this lecture review show, fine types will display inside the review the directories with folders and show the files inside the least view in different formats. First, I would maximize the form. Then we go inside the toolbox in search for review and double click. Then we need a least view we need also for labels and two combo box. We named the labels first label the text. We changed the Jews, these Dr and the First combo box. We go Inside properties dropped down style and changed the drop down list. The second label change the text. So directory structure the further label, the chosen files from the selected for their label. For We Changed the Takes Toe show as and also the combo box, we change the drop down style to drop down list. Then, inside the combo box toe, we Goto Properties items collection and five rows. First big icons, then dials, then small because least and details. We breast OK, Then we go inside the toolbox and search for image least and odd. One more copy based toe image least First we pressed on the image least one. We go to the properties images collection and other collection. We go inside the file review show, find types bean debug in the first this dog open, then odd J paying open Odd takes there. Open on no type open Odd. Any open on PNG Open on html open. Okay, then we press on the image least toe. We go to the image size and change toe 48 with 40 a height, then images collection on first his dog open Odd J peg open, then takes them open on no type open on any open odd PNG open on html. Open impress. Okay, then we go inside the source code. First we declare a new library using system that input output for files. Then inside the public class, we create the string variable these that holds the current disk. Then we create a new function that returns the file name, public string, short name, string as in I equal s that length minus one. While this off. I different then slash slash I minus minus. Then return as that sub string off. I blast one. Then we create another function that the returns the extension off the file. Public string said extension string us in I equal s that length minus one, while as off I different than a dot Then I minus minus and return as that sub string off I plus one. Then we create the function that populate the review With directories we go recursive Lee through all the folders on the disk, build the directory three starting with the known and take all directories in the path intercepted We create the function private Avoid populate that has to arguments string bad and three node No, inside the populate function First we create variable string array off directories. There's equal directory that get directories with the bat, then for reach for each directory string They're a local variable In directories we great another variable string array as equal there that splayed in the slash After we separate the pat after slash, we create a new directory name last in the path three node the n equal new three node as off index as that length minus one. Then we add the Keuren node or directory node, not nodes. That ad the three note Then we call recursive Lee the function populate with the bath there and the three node the end then we want toe set these lines off gold, you know, try block and use. Also a catch block exception X message box that show eggs that message. Then we need to set the events for the controls. We go inside the form. First, we double click on the form, and we have form one load. Then we need com a box one. Goto the events and double click on Select in Exchange the same for combo box toe Select in the exchange DoubleClick. Then we go to the review, go inside the events and select after select DoubleClick and also lease View one. We need double click inside the form one load. We get that this drives from our computer. We are them toe the combo box one and said the least view image formats off the files. First we get the drives from the computer Dr Info array the equal Dr Info, not get drives. Then we add to the combo box combo box one, not items, not add range. The then we said Lee's view one, that small image least equal image, least one for little image. Then this view one. That large image least equal image list toe the least view one that columns that ad the name file name. At least you won that. Columns not add the extension file diaper, and please view one that columns not and the defamation di mation in bites Be then inside the combo box one select in exchange. First we said the chosen drive this equal comma box one that text we permit modifying inside the review review one that begin update. Then we delete all nodes Review one that nodes not clear. And we are the node initial chosen disk to review one. The nodes that ad the disc. Then we put slash after the letter off the disk this equal disk plus solution. Then we call the populate function populate the bath. Is that these in the node three view one that knows off index zero and we end modifying inside the review three view one that n update then inside the combo box to select in the change when we select a note from the review which is on option and display the former for the files inside the least view. First, we choose an option from the comma box, toe switch combo box toe that selected index. We choose the display mode off files inside the least view case zero least view one that view equal view that large icon in the break, then case one least. You want that view equal view that style and the break case Do least you want that view equal. View that small icon Bray case free least. You want that view equal view that laced rake and case for please view one that view equal view that details in the break and also for the details we want to say the weed for columns . Lee's view one that columns off index zero that with equal 150 then least view one that columns off index one that grade equal 100 and the same for these view dot columns off index to does with 100 and also for the least view one that columns off index toe. We want to say that takes a lying as a result, Tal A. Lyman, the right will continue on the next lecture 41. Treeview Show file types details (Part 2): hello in this lecture will continue with the three view one. After select inside the function we create a variable in and the number of files then leave you one that items that clear, we clear the lease view. Then we great a string variable there. Equal review one that selected node that full bad. The chosen folder. We get the final names from the folder string array and files equal directory that get files the air. Then we come the number off files and equal and files that count. We create an items for the police view lease view I thumb array L I least items equal new these view item off index and then we great the variable I equal zero, we said as default. Big icons least view one that view equal view that large icon. Then we start modifying inside the least. View Lee's view one that begin update for reach String as in N files for each file name. We great. I'll lease view items l I off. I equal new lease view item. Then we switch and choose the image off their extension switch Said extension as first case . Doc L I off. I off image index equal. Zero I off I That's assume I thumbs not and word document less or equal with 2000 free, then a break. Then we copy this line eight times. Then we said the next case, Doc, Ex Image Index zero and the string were document greater or equal with 2007 then case J Peg Image Index one and the String J Peg image. Then day Stan Image Index. We said toe to in the string they stay file then any the image in days we said before in the string Any file, then the next case is PNG Image Index. We set the five and the string B and G image the next case. We said toe H d m image index six and the steering html page the same next one h t m l html page and the less one is the fall the image index we Seto free and the string unknown file . After that, we take the information about final name s file info. If I equal new file info off as then we they the dimension in bites l I off i that soup items That and if I that Lend that to string plus bites. Then we take the short name off the file. I off I that text equal Short name off s then upto the lease view. Please view one that items that ad I off I Then we end modifying inside the least view least view one that end update, then inside the least view one DoubleClick. First, we create a variable string as equal lease view one that selected items off index zero that text, we take the file name, then we create another variable string. Bad equal three view one that selecting known that full pad the path through the chosen folder. Then we choose the program after extension switch said extension as and convert to lower case to lower case takes them. Cease them that the agnostics that process not start and take no bad in the path plus slash plus s on the break. Then copy this line seven times. Then change the extension, the dog and the program. When word then case duck eggs, the same wind world, then case j paying And the program is m s pained then BMG the same m s pain then any with, uh no bad case. HTM and HTM l and the program is fire folks the same fire folks. Then we said the default message box that show unknown file and also a break. Then we want to change inside the populate function inside the catch block. We delete the eggs for the exception and inside the message box, we simply print a message. Show the selected this inside the review. Then we go to the debug started the bugging. We see the form we choose the disc show the selected disk. Inside the review we spend in search for one folder files and we have the fires large. I cause Dial's small Lycos at least and the day lis and also we can open. 42. Conclusion: Hello in this lecture will close the course with four steps that you need to make them in order to get what you want in life and also in your career. Other beginning, set your objectives. You need to know where you going, what you need to do, so because when you know exactly what you must go, then you follow the steps to accomplish your target. I would trust and perseverance make an action plan. If you discover that some rose that you have done, get your productivity higher, continue to apply on them, be consistent and continue with the actions that brought you benefits. Because if you follow them constantly after a while, you will see that these steps gained pressures. Time for action be organized. You need to make what you established without mixing your work. Gather the ideas and make priorities for each idea implemented. Learn permanently. It is very important to continue learning regardless of your industry. Things have a habit off constantly changing, and you have to keep up