Hello World! I'm talking about the code to read a file in C#. I have the program that I created in the last video. And the listbox called lstFile. And we have the menu and you have the tool strip. One of the ways of getting into the code, of course, would be to click on one of these buttons. But for the file, may be the easiest way to do is to find something like open and then click the little lightning bolt here to bring up the events. and then we can just double-click on that. Sometimes when things are buried in the menu, that's an easier way to find the code. I'm going to start at the top and talk about each of the functions in this program. To start with, it is a very good habit to have comments at the very top giving your name and a description of what the program does. Here's the main part of this program, is to read the file and I'm calling that from a few other places but let's talk about that The first thing I do is set sorted to false for the listbox so that whatever order there in in the file, they will come in in that order and then there's a button to sort them if you want to do that. Next I set the filter and I want the text files, that's the human term there. and that*.txt is the system term, or computer term. And these are all separated by that pipe, or bar. And then after the next bar, it says all files, that's in human terms. Another pipe and then *.* After I set the filter I show the dialog, And that's shown modal, meaning that it stops, it waits for me to select the file, and then continues on with the next statement. I'm simply displaying the name of the file as the title, or the text for the form. The next statement, this reads the entire file into an array. So I declare an array called lines which is a string. and then it's all of this code and you're not going to actually type most of that. When you type system dot (.) You can pick IO, Dot and pick file, and then dot and pick this. And then whatever the name of that file is, that the user selected from the dialog box. Then I have a for each loop to add each of those lines that we read in to the listbox. So for each line in that array we add that line to the listbox. That's read file. So menu open (mnuOpen) we read that file, we just call that code. If there's already something in the listbox, it'll add to what is already there. But when we click new (mnuNew) It clears the items from the listbox, and then reads the file. For the tool strip, I want to keep all the code in one place. For new we have two lines. I just called new and pass it sender and e. The easiest way to do that is to just copy this, and then remove the word object and system event args. Doing the same thing for open. Menu exit (mnuExit), we just say close. We close the form, we close the program. Iif you click the button that says sort, I just say that the listbox is sorted equals true. Note there's no way to unsort that. If it's sorted, it'll stay sorted until you read in a new file, and so on. This piece of code here, When the form is resized I make the listbox fill the form. So I make the width of the file list width [stumble] (lstFile) of the listbox, the width of the form. And a hight of the listbox is the height ofthe form, minus the Y location of the listbox. So that's underneath the menu and the tool strip. When an item in the listbox is selected I copy it to the clipboard. And so it's clipboard dot set text the listbox dot text , and that's whatever is selected, will be put on the clipboard. You could paste that anywhere using control+V after that. And the sort again I simply call the menu item for that, and that's it. So let's take a look at what happens when we run it. And if I click open, I can select Let's say a persons information. And if we click his social security number, or his phone number , or his street address, that's on the clipboard. And we could paste that somewhere if we wanted to. We can sort it. And if we click open, it'll read the next piece of information on top of that. Some C sharp comments, these are things I type over and over. OK: "Every function should have a comment to describe what it does." And so on and ... That's it, that's the whole deal.