1. Are there any examples of these codes on the website and if not can you put them on so I can get a better look?

·        I think everything we did in class is out there – two versions of TryFiles (my first), the LotterySim with files, and the BuyDVD with files. Look under Review – fairly far down the page.

  1. Can you go more in depth with CreateText and AppendText?

·        There’s not much more depth. Each receives one parameter – the filename or path to open. Either one opens the file and returns a StreamWriter reference that can be used later to write to the file.  CreateText opens at the start; if the file already exists, the open will cause previous contents to be lost. AppendText opens, ready to write at the end, after previous contents.

  1. When are we going to use this in a program?

·        Next program (assignment 8)

  1. Could multiple files be read at the same time when an event occurs?

·        Well, no at the exact same time because one statement if executed at a time. But you could open one file, open another file, reading from either as needed before closing (you can have two files open for reading at the same time).

  1. Is there any limit on what you can write?

·        I believe you can write until your disk is full. As for content, you can write anything that has ASCII codes -  letters, numbers, lots of special characters.

  1. Do the files have to be put in the bin or can they be put somewhere else?

·        The default location is in the bin folder. Other locations would have to be specified more fully, and there is a danger that the same folder structure may not exist if the program is copied or moved.

  1. Is it more efficient to use sequential files or random?

·        Each is more efficient for some things. When you want to access data in order, sequential files are more efficient. But if you are only interested in certain data, a lot of searching may be necessary to find the data that you need when using a sequential file.

  1. Can you use files other than .txt?

·        With the techniques that we have used, you are always reading/writing Text files. There are some file extensions besides .txt that can be text files. However, a lot of them are binary (which can be written in VB, but which we will not cover this semester).

  1.  Can you tell the program to write to a different format other than txt, like Excel?

·        Excel files are not Text files (if you open with Wordpad or notepad, you can see letters where words have been entered into Excel (text is stored as ASCII), but there are many things that cannot be read (binary). So you could not write an Excel file with the techniques we have discussed.

·        Excel’s format is “proprietary.” I would expect that they do not tell people how to write .xls files.  How do they represent formulas? How do they represent formatting (bold)? How do they represent what worksheets there are?  Perhaps they have disclosed these things so that, say Lotus 1-2-3, can do a “Save As” as an Excel spreadsheet. But I have never seen it.

·        However, Excel is good at opening up text files. If there is a consistent separator (such as a comma) or the columns are consistent in spacing, Excel will do a good job reading it in. It will be even easier if you make the extension .csv. So you can write something that Excel can read using the techniques that we’ve discussed.

  1.  What’s the easiest way to output the data once read in?

·        I’m not sure what is being asked. I think  - Write it to a file. Or are you considering on-screen output?

  1.  Can we import jpeg or gif files into the program?

·        Yes. The easiest way I know is to put a PictureBox control on the form and set the Image property

  1. How is a database different from a file?
  2.  Are databases easier to use than files?

·        They are more powerful and flexible than files because there is a software system (Database Management System such as MS Access, or Oracle, …) that provides many capabilities for searching and manipulating the data. However, writing to a DB or reading from a DB requires more knowledge and some more overhead than using files.

  1. How much more difficult is this to set up with a database?

·        It is fairly complicated. See chapter 12. You have to set up a data control on the form. You have to specify an ODBC Data Source using the Administrative Tools in the Control Panel under Windows. You have to learn some SQL in order to write the commands that interact with a database. Too much for this class.

  1.  How can you format already existing text in a file?

·        I’m not really sure what you mean. Do you mean things like a Word Processor does (bold, indent)? Or changing the organization? You can do lots of things; you may be reading a file and then writing back to it; the program itself could be fairly complicated depending on what you mean (MS Word is a huge program (it also doesn’t write Text files)).